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 unable to understand Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "unable to understand" Watch "unable to understand" New topic
Author

unable to understand

Bhuvana Dhruva
Greenhorn

Joined: Sep 11, 2000
Posts: 28
public class test {
public static void main(String args[]) {
for(int i = 0; i < 3; i++) {
for(int j = 3; j <= 0; j--) {
if(i == j) continue;
System.out.println(i + " " + j);
}
}
}
}
this program does ot giv an output. but iam unable to understand why. please explain
thanks in adv,
bhuvana


Bhuvana
Jonathan Jeban
Ranch Hand

Joined: Oct 08, 2000
Posts: 52
Hi Bhuvana,
Shouldn't the for loop should be like this?
for(int j = 3;j >= 0; j--) {

Hope this helps..
Jeban
[This message has been edited by Jonathan Jeban (edited October 31, 2000).]
Michael Hildner
Ranch Hand

Joined: Oct 13, 2000
Posts: 297
Looks like a typo:
for(int j = 3; j <= 0; j--)
j starts off as three, so j<=0 is false. Try changing to >=0
 
 
subject: unable to understand
 
Threads others viewed
why does 'break' traverse one more time
postfix operator
Flow control
Flow Control -JQ+
Doubt on Post Increment operator.
developer file tools

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture