Ask Experts Questions for FREE Help !
Ask
    aalabb01's Avatar
    aalabb01 Posts: 1, Reputation: 1
    New Member
     
    #1

    Oct 27, 2013, 11:50 AM
    Loop
    I wrote two loops, my problem is if the program execute the first loop then the second it works fine. However, when it finishes from the second loop first time then to goes back to the first loop it will not get into the second loop again. it will iterate inside the first loop until the end.
    in the following is my code and the result I get:

    try { int n=0; int I=0;
    String line;

    char c=0;
    char [] arr1=new char[6];

    while ((line = br.readLine()) != null ) {
    if(n<1250) {
    n++;
    System.out.print("0"+n+"\n");
    for(;c != ',';i++){

    c=line.charAt(i);
    arr1[i]=c;
    System.out.print(arr1[i]);
    jTextArea7.append(c+"");
    }
    }
    }
    }


    result:

    01 //result for the first loop
    vhigh,02 //result for the next loop
    03//goes back to the first loop (until here fine)
    //but after this point I want the compiler to execute the second loop again, it stay //iterating within the first loop
    04
    05
    06
    07
    08
    09
    010
    011
    Scleros's Avatar
    Scleros Posts: 2,165, Reputation: 262
    Hardware Expert
     
    #2

    Nov 30, 2013, 09:20 AM
    What is the value of 'c' each iteration?

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Loop to zero values. [ 18 Answers ]

Hi all, I need a loop to zero values on sheets in my workbook. It will be best to have a look at the sheet attached, I will explain further. The sheets vary in length from day to day. For sheet "Emb" I need the columns "H" and "I" zeroed if grater than 0, starting at row 5 and is fixed at...

For loop [ 1 Answers ]

How would I design a For loop that displays the following set of 10, 20, 30, 40, 50,. 1,000?

BindingContext Loop [ 1 Answers ]

I am new to this forum, but need assistance. I will preface this as my homework. I do not expect specific answers, but a point in the right direction is much appreciated. Assume that a form's BindingContext contains a DataSet named dsSample with a table named tblResponses. Write a loop to...

Computer in a loop? [ 3 Answers ]

When I turn on the computer it acts like its going to open windows xp, then it goes to a blackscreen that says no signal, and the restart info screen. I tried it on 2 monitors and they both say the same thing, no signal. Not sure what is werong. Help, :confused:


View more questions Search