GeeCON Prague 2014*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Operators 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 "Operators" Watch "Operators" New topic
Author

Operators

mohit joshi
Ranch Hand

Joined: Sep 23, 2000
Posts: 243
for(int j=0,k=0;j<10&&k<10;k+=++j==10?1+(j=0):0)

System.out.println( " k "+k+", j "+j);
guess what the above code does?
[This message has been edited by mohit joshi (edited November 17, 2000).]
bill bozeman
Ranch Hand

Joined: Jun 30, 2000
Posts: 1070
Interesting little piece of code. At first glance I thought it would cause an infinte loop, but I can see why it gives the output it does. However, in the sake of readability, if any of the programmers I work with did that, I would have to kill them.
Peter Lyons
Ranch Hand

Joined: Sep 12, 2000
Posts: 202
It gives me a headache?
mohit joshi
Ranch Hand

Joined: Sep 23, 2000
Posts: 243
please dont kill me, I am only experimenting with operator precedence
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Operators