Languages

Java - what is the difference between creating String object as new("Test") and literal eg: "Test"

3 points
Asked by:
Tehya-Blanchard
324

In java - what is the difference between creating String object with new operator and literal "our string here".

For example:

String text1 = new String("Test");

vs

String text2 = "Test";

What is the difference between those 2 strings?

0 answers
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join