Thus far, we have used BlueJ to create and manipulate objects. We also saw that BlueJ could be used to record our interactions as translated to Java syntax. Our goal here is to further understand the elements of syntax seen in such a sample of Java code.
We strongly recommend the use of the text as a resource. In these notes, we simply outline some of the early issues to address, giving specific references to their early treatment in the text.
comments, white space, indenting
(see p. 40 of text, "Program Layout")
(see top of p. 55 of text, "Java Language Rule")
Statements, curly brackets and semicolons
(see p. 44 of text, "Statements")
Primitive Data Types vs. Objects
(see p. 42 of text, "Primitive Data Types")
(more detail at p. 102 of text, "Primitive Data Types")
identifiers (classes, methods, variables)
(see p. 42 of text, "Identifiers")
(see p. 43 of text, "Variables")
Method Definition (including accessibility, return value, parameters)
Variables (primitive vs. reference)
Class Definition
(see p. 40 of text, "Java Class Definition")
(much more detail p. 100 of text)
Object Instantiation
(see p. 41 of text, "Object Instantiation")
Method Invocation
Qualified names and dot notation
(see pp. 52-53 of text, "Qualified Names in Java")
Many of these syntax issues are revisited in more detail in the "Java Language Summary" given on pp. 100-106 of Ch. 2.