Lecture 4
19
Strings
•Class String predefined in Java
•A string is an object, not a primitive type
•Can use = for assignment
•  String greeting = “Hello, world”;
•Can’t use == for equality, since Strings are objects
•Test equality by sending an equals message:
•     if (command.equals(“exit”)) {