Top community members

If you think it is valuable to share IT knowledge and help others.

It is the right place for you. ❤ 💻

Join our community.

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

3 points
Asked by:
JustMike
3364

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

Checkout latest Findings & News:

Checkout latest questions:

Checkout latest wiki articles:

Hey 👋
Would you like to know what we do?
  • Dirask is IT community, where we share coding knowledge and help each other to solve coding problems.
  • We welcome everyone,
    no matter what the experience,
    no matter how basic the question is,
    this community will help you.
Read more