11/28/2011

String Tricks

public static void checkFundaString(){
String a="Test :";

System.out.println("FIrst Conditions :" +a + 5 + 5);
System.out.println(5 + b+ a +"Second COndition :" );
System.out.println(5 + 5+ a +"THis Is THird");


}



Output is:
FIrst Conditions :Test :55
55Test :Second COndition :
10Test :THis Is THird



BCOz First two conditions concat so last 5 will also concat,
But first 2 oprands are Integer then iw will calculate to 10.

No comments:

Post a Comment