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.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.