This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have David & Dawn Griffiths on-line!
See this thread for details.
Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

continue statement

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which all lines are part of the output when the following code is compiled and run. Select all correct answers.

public class test {
public static void main(String args[]) {
outer: for(int i = 0; i < 3; i++)
for(int j = 3; j >= 0; j--) {
if(i == j) continue outer;
System.out.println(i + " " + j);
}
}
}
}


a. 0 0
b. 0 1
c. 0 2
d. 0 3
e. 1 0
f. 1 1
g. 1 2
h. 1 3
i. 2 0
j. 2 1
k. 2 2
l. 2 3
m. 3 0
n. 3 1
o. 3 2
p. 3 3

answer is b,c,d,g,h,l.
How?
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Compile and run with these println statements added to the code.
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think the output should be in the order,
d,c,b,h,g,l as i is incremented and j is decremented.

Am i correct? I'm at work. so, can't compile & check.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think the question asks you to enter select all correct options and not the specific order (though the order you have given is correct).

Just curious, why cant you compile a program at work. I would guess that you are a programmer and should have access to javac and java
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic