String concat method used to Concatenates the given string
String h="Hello ";
h=h.concat("World");
System.out.println(h);
o/p Hello World
Using concat method we can Concatenates only strings.
String '+' operator used for Concatenates with another objects or primitive types.
String test="They are total "+7+"Fruits";
In the above string we concat string with integer primitive type.
String sample="The total percentage is "+ 70.5;
In the above string we concat string with float primitive type.
Wednesday, April 21, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment