This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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
 
Similar Threads
doubt in scanner
return types scjp1.4
Exception HAndling
Process of System.out.println()...
Exception