Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16
  1. #11

    Default Re: loop in java. help


    if you noticed, wala ko nag initialize sa mga declared variables.

    but naa ko method nga

    Code:
    private void setRows(int rows){
         this.rows = rows;
    }
    the method above literally means, this class' rows = rows where rows (bolded above) is ang user's input.
    Also called, Encapsulation

    I didn't put "find" sa akong code above, because I want you to understand first.
    But naa na ko diri complete code nahimo.

    based sa imu gi-himo, mao ni nahitabo..
    Code:
    do{
       pero diri sa sulod gibutangan nimo og tf=false;
       So, do you think loop ni?
    }while(tf==true);
    para mo-padayon na siya, tanga-tanga ang tf=false;
    Last edited by stealthghost; 02-12-2012 at 05:32 PM.

  2. #12
    Elite Member
    Join Date
    May 2011
    Gender
    Male
    Posts
    1,465

    Default Re: loop in java. help

    ako i.try bro. update lng ko ugma. nag.gamit2x pako sa imo codes run

  3. #13
    Elite Member
    Join Date
    Jun 2010
    Gender
    Male
    Posts
    1,018

    Default Re: loop in java. help

    I'll just start from stealthghost's explanation

    Code:
     do{ 
           try{ 
            
           System.out.println("Input rows: ");
           rows = Integer.parseInt(in.nextLine());
           System.out.println("Input columns: ");
           columns = Integer.parseInt(in.nextLine());
           array = new int [rows][columns];
           input = 0;
           display = 0;
           search = 0;
           [BOLD]tf=false;[/BOLD]
           bk=false;
           l = 0;
           j = 0;
            Process();
            
           }catch(NumberFormatException nfe){System.out.println("Invalid"); tf=true;}
           
           }while(tf==true);
    With this code in BOLD, you intentionally ended your loop, mao dili magbalikbalik. tf = false.

    Also "this" is your literal reference to yourself.
    Since with java you can have same variable names or method names in different objects or methods.
    You need some kind of reference to denote that you want to use the current object you are using.
    So to escape the ambiguity you have "this", with other OOP languages you can use "self" or "me"(tingali lang ni ang me)

    So kung kita ka og "this", this means "kani nga object".

  4. #14
    Elite Member
    Join Date
    May 2011
    Gender
    Male
    Posts
    1,465

    Default Re: loop in java. help

    ok salamat mga bro. fixed na nako. sabot nako

  5. #15

    Default Re: loop in java. help

    magkatawa man ko sa gusto nmo e achieve... pero bahalag d magka dimao bsta maningkamot lang..

    para sa TS: at least kabalo ka sa gusto nimo e achieve compared sa uban dretso post assignment..

  6. #16

    Default Re: loop in java. help

    brad ayaw i sulod sa imong constructor ang imong main loop sa program.
    ang imong ToString Method dapat mo return og string nga "meaningful" nga ayaw butangi og System.out.println

    I organize ang class nimo maau nga mo make sense siya dili lang haron choi tanawon ang Main() function ehehe.

  7.    Advertisement

Page 2 of 2 FirstFirst 12

Similar Threads

 
  1. Help FileHandling in Java
    By kel2985 in forum Programming
    Replies: 3
    Last Post: 03-10-2011, 10:08 PM
  2. user defined class in java [help]
    By xianz87 in forum Programming
    Replies: 1
    Last Post: 07-06-2010, 07:53 PM
  3. Need help in JAVA plsss.. help 25problems..
    By FrozenBoi in forum Programming
    Replies: 89
    Last Post: 02-09-2010, 02:26 PM
  4. NEED HELP in JAVA EXCELAPI
    By rastaman81 in forum Programming
    Replies: 1
    Last Post: 05-11-2009, 09:17 PM
  5. need help in java programming: creating a folder
    By rastaman81 in forum Programming
    Replies: 4
    Last Post: 03-11-2009, 08:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top