my dog learned polymorphism*
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


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Output of the program" Watch "Output of the program" New topic
Author

Output of the program

vijaya tr
Greenhorn

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

public static void main(String[] args) {
int i=2 + '2';
System.out.println(i);
}
}
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
------------------
Sachin,
****************************************************
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: http://aspose.com/file-tools
 
subject: Output of the program