File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programming Diversions and the fly likes Can you guess the output of this program ? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Other » Programming Diversions
Reply Bookmark "Can you guess the output of this program ?" Watch "Can you guess the output of this program ?" New topic
Author

Can you guess the output of this program ?

salvin francis
Ranch Hand

Joined: Jan 12, 2009
Posts: 904

The puzzle is simple,
You have a program, you have to guess the output of this program, its not as simple as it looks.




You may use paper or calc, etc. If you want to know whats the right answer or you want to cheat, just run this program

All the best


I came, I saw, I set a new standard.
[Salvin.in]- The way websites should now be.
salvin francis
Ranch Hand

Joined: Jan 12, 2009
Posts: 904

for those requiring help:


Math.pow(x,y);
x to the power of y:
eg: Math.pow(2,3) = 2 to the power of 3 = 8
---------------------

x^y
This is called XORing, refer to XOR
eg: 12^23=27
---------------------


int x = a + b++;

is equivalent to

int x = a + b;
b = b + 1;
---------------------


post here for any more assistance...

 
IntelliJ Java IDE
 
subject: Can you guess the output of this program ?
 
Threads others viewed
Compilation errors - URGENT!!!
Just Java 2 clock class help required (Resolved)
Is this a bug?
Java Chess Game I made by my self
Animated Line for sorting
MyEclipse, The Clear Choice

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