This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes marcus green mock Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "marcus green mock" Watch "marcus green mock" New topic
Author

marcus green mock

deep rai
Ranch Hand

Joined: Oct 04, 2007
Posts: 56
hi,
the below code is from marcus green mock 1 -- i m not able to understand the out of this code.. it prints

value for i=1 value for j=1
value for i=2 value for j=2 please explain



public class MyFor{
public static void main(String argv[]){
int i;
int j;
outer:
for (i=1;i <3;i++)

inner:
for(j=1; j<3; j++)
{
if (j==2)
continue outer;
System.out.println("Value for i=" + i + " Value for j=" +j);
}

}

}
Varalakshmi Ramanarayan
Ranch Hand

Joined: Oct 28, 2007
Posts: 108
hi,
this code gives the below output.
value for i=1 value for j=1
value for i=2 value for j=1

if the value of j is equal to 2 it control moves to the outer loop,skipping the print statement.


SCJP 5 - 87%<br />Next SCWCD
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: marcus green mock