Java for
Beginners University
Greenwich
Computing At
School
DASCO
Chris
Coetzee
What do I need for Java?
JDK IDE Java!
JDK (Java Development Kit)
download from Oracle
IDE (Integrated Development Environment)
Many options:
Eclipse (eclipse.org) PC and Mac version
BlueJ (bluej.org)
Netbeans (netbeans.org) ALL FREE!
3 Laws of Java
1. Every line ends with a ; unless the
next symbol is a {
2. Every { has a }
3. Classes start with capital letters,
methods and variables start with
lower case letters
Syntax rules
Classes start capital letters and have no ( )
Methods start lowercase letters and have a ( )
Variables always start with a lowercase letter
= means gets the value of
== means equals when comparing numbers
.equals() means equals when comparing words
Javas structure
Java programs are called classes
They exist inside a container called a project
All classes have at least one method called main()
Project: CheeseCake
Class: CheeseCake
Method: main()
We write our code here
Java class example
Java class example
Class name
Main method
Dont worry!
The IDE (Eclipse) automatically makes
all the gunk at the top public this, void
main that
Levels of coding
Learning to program
can be difficult if you
dont learn things in
the right order.
Each level depends on
a firm understanding of
the previous level.
It works!
Levels of Java coding
1: Syntax, laws, variables, output
2: Input, calculations, String manipulation
3: Selection (IF-ELSE)
4: Iteration/Loops (FOR/WHILE)
5: Complex algorithms
6: Arrays
7: File management
8: Methods
9: Objects and classes
10: Graphical user interface elements