• 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:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

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
 
What do you have to say for yourself? Hmmm? Anything? And you call yourself a tiny ad.
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic