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.
- Review the values, variables and types presentation
- Download the eg2.java source
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.
- Identify all the values, variables, types, objects, fields and classes.
- Using examples from this code, describe the difference between the following pairs of concepts.
- a value and a variable.
- a variable and a type.
- a variable and an identifier.
- a variable and a field.
- a class and an object.
- a value type and a reference type.
- Identify and describe the public behaviour exposed by the TiledMap2_0 class.
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.
It was noted at the start of this section that this code is not good programming practice;