String type | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

String type

What is the difference between lines below? String str = new String("123"); String str = "123";

26th Sep 2016, 6:47 PM
Artyom Gusev
Artyom Gusev - avatar
2 Answers
+ 1
"123"; summary new string("123");
26th Sep 2016, 7:10 PM
mohamad.khalili
0
fisrt str is a object of a class but the second str is a variable.
26th Sep 2016, 9:50 PM
mamadgig
mamadgig - avatar