File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes deal with loops..... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "deal with loops....." Watch "deal with loops....." New topic
Author

deal with loops.....

faiza haris
Ranch Hand

Joined: Oct 17, 2000
Posts: 173
What is the easiest way to get the answer for the following code??? Since we�ll be short of time , how is it best to work out this problem and find the result values? write on paper or???
class Testjranch
{
public static void main(String args[ ] )
{
int k = 0;
int m = 0;
for ( int i = 0; i <= 3; i++)
{
k++;
System.out.println( k + " k after k++, " + m );
if ( i == 2)
{
continue;
}
m++;
System.out.println( k + " m after m++," + m );
}
System.out.println( k + " outside for loop, " + m );
}
}
Bhuvana Dhruva
Greenhorn

Joined: Sep 11, 2000
Posts: 28
hi,
i think the best way is to work it out on paper. i don't think that u will lose much time in that and also can reduce errors, things will be more clear.
bhuvana


Bhuvana
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: deal with loops.....