+ 2

String vs. String Literal

What is the difference between a string and a string literal? Better yet, what makes a string NOT a string literal? Please provide examples.

8th Jul 2017, 9:06 PM
Nikolas Bussey
Nikolas Bussey - avatar
1 ответ
+ 1
A String literal is a Java language concept. This is a String literal: "a String literal" A String object is an individual instance of the java.lang.String class. String s1 = "abcde";
8th Jul 2017, 9:29 PM
Mehman Ismayilov
Mehman Ismayilov - avatar