Punctuation
You've already seen the basics of Java punctuation. Statements are ended with a semicolon (;). You can also use the comma to separate identifiers, like this:
int x, y, z; // This declares three ints, called x, y and z respectively
The other main punctuation you regularly use are curly braces . You use curly braces, followed by no punctuation, to delimit class definitions and method definitions, like this:
class Book { method checkOut() { } // End definition of method checkOut() } // End of class definition for Book
Class definitions are not followed by a semicolon as a C struct or C++ class definition is. Also, as noted earlier, all the methods of a given class must be defined inside the curly braces that delimit the ...
Get PURE Java™ 2 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.