File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Output of the program 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 "Output of the program" Watch "Output of the program" New topic

Output of the program

vijaya tr

Joined: Dec 13, 2000
Posts: 2
class Q19 {

public static void main(String[] args) {
int i=2 + '2';
When I compile and execute this program the output is 52. Can somebody explain
sachin patel
Ranch Hand

Joined: Nov 28, 2000
Posts: 75
This is what i think'
ASCII value or better Unicode value of '2' is 50 and that is added to 2 which makes it 52....
Hope this helps
Learn from others mistakes. Life is too short to make all yourself.

Sachin,<P>****************************************************<BR>Learn from others mistakes. Life is too short to make all yourself.<BR>****************************************************
I agree. Here's the link:
subject: Output of the program
jQuery in Action, 3rd edition