It is object contains a collection of 0/ more.
Examples:
1. char[] cc={'w','i','s','d','o','m', ' ' ,'m','a','t','e','r','i','a','l','s'};
2. String str = new String (“wisdom materials”);
1. Write a program to concatinate 2 stings.
Program
|
Output
|
public class concatstrin{
public static void main(String args[])
{
String s1="wisdom ";//creates string
char[] cc={'m','a','t','e','r','i','a','l','s'};
String s2=new String(cc);
String s3=s1 + s2;
System.out.println(s3);
System.out.println(s1.concat("materials"));
System.out.println(s1.concat(s2));
}
}
|
wisdom materials
wisdom materials
wisdom materials
|
|