DRAFT
NoCallOnStringLiteral
Incorrect
One cannot invoke methods on String literals
Correct
One can invoke methods on String literals
CorrectionHere is what's right.
Here is what's right.
Wrong. A String
literal denotes a String
object. One can invoke methods on it like one can invoke methods on any String
object. All the following are correct:
int a = "Hi".length();
int b = new String("Hey").length();
String s = "Ho";
int c = s.length();
Language
Java