Languages

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

3 points
Asked by:
JustMike
3593

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
50 000 ad impressions - 449$
🚀
Get your tech brand or product in front of software developers.
For more information contact us:
Red dot
Dirask - friendly IT community for everyone.

❤️💻 🙂

Join