August 2004
Intermediate to advanced
480 pages
9h 41m
English
Strings are objects. Their superclass is java.lang.Object (they inherit all of the properties and methods defined in the Object class, and then define some of their own). As we know, everything in Java is an object (except for the primitive types such as int, boolean, and char), and they all have corresponding object types that are often called “wrappers”.
If you want to be a big nerd and make everyone hate you, create a String like you would a regular object:
String s = new String("Sucker!!!");
If, for some reason, you do not want to be a big gigantic nerd and force everyone to hate you, use the following simpler, more common, and more efficient syntax to create a String:
String s = "All the cool kids do it";
If Java ...
Read now
Unlock full access