- ...compiled1
- Don't worry if you don't know what this means
yet; you will be shown how to compile a program during the first
session.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
- ... processor2
- The processor is the part of the
computer which does all the work, e.g. the Intel Pentium processor in
your PC.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
- ... comments3
- Appendix B,
Dealing with Errors, explains this and other techniques for
debugging.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
- ... bits4
- A bit is the smallest unit of computer memory. It may be thought of as either a 1 or a 0 in some binary code. 8 bits make up 1 byte of memory.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
- ... copy5
- It is a good idea to save versions of your
programs as they develop so that if the changes you make cause new
errors you have a working previous version of your program to refer
to. Remember to change the name of the public class so it matches the
filename.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
- ...initialise6
- Initialise --
assign a value to a variable for the first time
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
- ... below.7
- NB the type conversion
examples above work for JDK 1.3, but older versions of Java, e.g. J++,
do not support this syntax.
Instead you have to use something like this:
x = Double.valueOf(temp).doubleValue();
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
- ...
site8
- http://www.pp.rhul.ac.uk/~george/PH2150/downloads/ArrayCopyDemo.java
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
- ... format9
- In the example, myFormat is actually
an object of type DecimalFormat, but objects will
not be covered until section 8, so for the moment you
can assume that it works like a variable which, rather than a number,
stores something more abstract which describes how to format numbers.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
- ... arguments.10
-
The area of a triangle with sides a, b, c is given by Heron's formula:
area =
where
s = (a + b + c)/2.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
- ... triangle11
- In
order for a, b and c to form a triangle, two conditions must be
satisfied: all side lengths must be positive; the sum of any two side
lengths must be greater than the third side length.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
- ...methods.12
- Because the variables exist independently
in their separate regions, there is no reason why they should not be
given the same variable name if you wish. Even if both were called x
the two variables would exist completely independently in their
respective scopes.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
- ...type13
- The word
type is used here in the same way as a variable may be of
type int for example.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
- ...
declarations.14
- The main method for the program should
still always be declared public static void and should be in a
separate public class that does not contain any
non-static methods or class variables.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
- ...seed15
- an initial value
supplied to the random number generator
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
- ... 616
- Older versions version of the JDK, such as 1.4.2 and 1.5
should also work fine.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
- ...
window17
-
Alternatively you can use the Jext console. This is not generally
recommended as it doesn't work correctly with programs that use
text console input. To show the Jext console pane, go to the Edit
menu of Jext, select ``Options...'', click on ``General'', then at the
bottom of the screen, check the box ``show top tabbed pane
(Console)''.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.