hi i am jane pls explain the difference between
string greeting = good morning string greeting = new string ("good morning");
1)String greeting = "good morning" is a String literal where as String greeting = new String("good morning") is a String Object.
2)String greeting = new String("good morning") creates two objects, one in heap memory and one in string pool.It utilize memory in a better way with fulfilling object creation. While String greeting = "good morning" creates one object which goes to string pool.It consumes less memory.