class Main {
public static void main(String args[]) {
String name="Work Hard";
name.concat("Success");
System.out.println(name);
}
}
Answer:
Work Hard
Answer:
String s = new String();
class Main {
public static void main(String[] fruits) {
String fruit1 = new String("apple");
String fruit2 = new String("orange");
String fruit3 = new String("pear");
fruit3 = fruit1;
fruit2 = fruit3;
fruit1 = fruit2;
System.out.println(fruit1);
System.out.println(fruit2);
System.out.println(fruit3);
}
}
Answer:
apple
apple
apple