Some Java language basics.

This section is not so much concerned with the tiled map scenario as with using it to review some basic concepts in programming languages that are often misunderstood.

  1. Review the values, variables and types presentation
  2. Download the source
  3. Compile, execute and review this program. Notes:
    • this code only partially meets the requirements outlined in the introduction chapter.
    • The coding in this file is not good practice (as we shall see in the next chapter); it is presented here to support the questions asked below and as a comparison with good programming practice that we shall see later.
    • If there are any coding aspects that you are unsure of then ask in the practical.
    • At line 19 we use the 'System.out.format(...)' method; you can review this formatting output method by reading the Oracle tutorial on output formatting.
  4. Identify all the values, variables, types, objects, fields and classes.
  5. Using examples from this code, describe the difference between the following pairs of concepts.
    1. a value and a variable.
    2. a variable and a type.
    3. a variable and an identifier.
    4. a variable and a field.
    5. a class and an object.
    6. a value type and a reference type.
  6. Identify and describe the public behaviour exposed by the TiledMap2_0 class.
  7. Draw a diagram of the variables, values, fields and objects that will be created when this program is executed. Explain how the types inform your diagram.
  8. It was noted at the start of this section that this code is not good programming practice; why not?