// Different ways of declaring and initializing Strings
package javaapplication1;
public class StringDemo {
public static void main(String ar[])
{
String str ="Abhishek";
String str1=new String(str);
String str2=new String("Anoop");
String str3=str2;
System.out.println(str);
System.out.println(str1);
System.out.println(str2);
System.out.println(str3);
}
}
package javaapplication1;
public class StringDemo {
public static void main(String ar[])
{
String str ="Abhishek";
String str1=new String(str);
String str2=new String("Anoop");
String str3=str2;
System.out.println(str);
System.out.println(str1);
System.out.println(str2);
System.out.println(str3);
}
}
0 comments:
Post a Comment