Tuesday, 12 March 2013

Interesting facts about Java

1) Think for the output and analyse:

public class CheckOutput 
{
public static void main(String args[])
{
System.out.println(2+2+"="+2+2);
}
}

Ans : Output
4=22
Note:
as Java starts treating everything as a String once it has encountered a string in System out statement.

No comments:

Post a Comment