2. Who Should Learn Java?
Have you done some programming?
Do you want to learn Java?
Do you prefer stimulating dinner conversations
over coffee to dry, dull, technical lectures?
Do you need this course to graduate?
6. What Is JAVA?
Java is a free, open-source, Object Oriented
Programming (OOP) language – everything is
contained inside classes and objects.
Java isportable – it can run on any machine
with a Java Virtual Machine (JVM) installed.
No matter what computer you have, you can
write the same Java programs.
7. How WEuse Java
V
i
r
t
u
a
Java l
Sourc
e bytecod M
Code e a
Compiler c
h
i
n
e
s
9. Code Structure in Java
Collection of Java files
source contains many
code classes
class
file A class
method aclass.java
1
statement contains many
methods and
variables
method public class aclass{
2
statement
public void
statement
method() {
}
}
10. What goes in the source
file?
A source file (with the .java extension)
holds one class definition. The class
represents a piece of your program,
public class Bicycle {
although a very tiny application might
need just a single class. The class must
go within a pair of
curly braces
The source file MUST have the same
name as the class. For example, the
Bicycle class must be stored in the
Bicycle.javafile. }
A class is the blueprint from
which individual objects are
created. clas
11. What goes in a class?
A class has one or more methods. In
the Bicycle class, the pedal method will
hold instructions for how the Bicycle
public class Bicycle{
should pedal. Your methods must be
void pedal( ) {
declared inside a class (in other words,
within the
curly braces
of the class).
}
A bicycle might have some }
methods such as:
speedup(), break(), gear(), directi
on()…
metho
12. What goes in a method?
Within the
curly braces public class Dog {
Bicycle{
void bark ( )) {{
pedal(
of a method, write your instructions for statement1;
how that method should be performed. statement1;
statement2;
Method code is basically a set of statement2;
statement3;
statements, and for now you can think statement3;
of a function or procedure.
} }
}
statemen
13. One Blueprint Can Be Used To
Help Build Different
Objects
Shape
rotate ( )
playSound
()
This is called
inheritance
Squar Circle
Amoeba
e Triangl
e
14. EVERYTHING
is made from OBJECTS
Object This is the Object class
from which ALL other
equals() objects are created.
getClass()
hashCode()
toString()
Shape
rotate()
playSound()
Circle
doSomething()
15. What You Will Get Out Of
Learning and Using Java!
Build your programming skills and confidence.
A thorough understanding of Object Oriented
Programming.
Learn a language that can be run on any platform.
Learn how to work and program in groups.
Develop Graphical User Interfaces.
16. Where To Start
Setup Eclipse Classic
Write your first Java program
If you can, bring your laptops to class every
lecture!