I\'m a C++ guy learning Java. I\'m reading Effective Java and something confused me. It says never to write code like this:
String s = new String(\"silly\");
String
s are special in Java - they're immutable, and string constants are automatically turned into String
objects.
There's no way for your SomeStringClass cis = "value"
example to apply to any other class.
Nor can you extend String
, because it's declared as final
, meaning no sub-classing is allowed.