public class StringTest {
public static void main(String[] args) {
/* The following two declarations will create 2 new objects
* */
String string1 = "The"; // declaring a String - method1
String string2 = new String("Testbook");
// declaring a String method2
System.out.println(string1 + string2);
// appending 2 String
//variables into one String. This will create a new object
System.out.println(string1.concat(string2));
//appending 2 Strings -method 2
}
}
TheTestbook
TheTestbook
No comments:
Post a Comment