Lesson 1 Introduction To Java
Lesson 1 Introduction To Java
⚫ Firstly, it was called "Greentalk" by James Gosling, and the file extension was .gt
⚫ After that, it was called Oak and was developed as a part of the Green project
that was started by small team of Sun Engineers (Called Green Team) in 1991.
⚫ Oak is a symbol of strength and chosen as a national tree of many countries like
the U.S.A., France, Germany, Romania, etc.
1. JDK Alpha and Beta (1995) 8. Java SE 6 (11th Dec 2006) 15. Java SE 13 (September 2019)
2. JDK 1.0 (23rd Jan 1996) 9. Java SE 7 (28th July 2011) 16. Java SE 14 (Mar 2020)
3. JDK 1.1 (19th Feb 1997) 10. Java SE 8 (18th Mar 2014) 17. Java SE 15 (September 2020)
4. J2SE 1.2 (8th Dec 1998) 11. Java SE 9 (21st Sep 2017) 18. Java SE 16 (Mar 2021)
5. J2SE 1.3 (8th May 2000) 12. Java SE 10 (20th Mar 2018) 19. Java SE 17 (September 2021)
6. J2SE 1.4 (6th Feb 2002) 13. Java SE 11 (September 2018) 20. Java SE 18 (March 2022)
⚫ Since Java SE 8 release, the Oracle corporation follows a pattern in which every even version
is release in March month and an odd version released in September month
| Object Oriented Programming with Java - Larisse Mahoro | 11 November 2023
Java editions
⚫ Java Micro Edition (ME) - designed for running Java applications
on mobile devices with limited resources.
int 0101110
main() 0010110
{ 1101010
} 1010101
For example…
Runs on an x86
processor
Test.c gcc.exe Text.exe
containing
x86 instructions
class
store x
Test {
pop y
…
load z
}
For example…
0101110
Windows 0010110
x86 JVM 1101010
store x 1010101
pop y
load z
0101110
Symbian 0010110
RISC JVM 1101010
1010101
Test.class
class Greeting {
Write the
public static void main(String[] args){ source file
System.out.println("Hello RCA Student!");
}
}
Compile the
$ javac Greeting.java class file
void walk(){
A method
}
}
}
}
Output text to
the console
⚫ You specify the name of the class and any arguments to send it, e.g.
⚫ The JVM searches the class for a method called main, and then calls that
method
⚫ It sends the arguments (e.g. "Hello" and "4") as items in the array called
args
int x = 10;
Initial value
Variable type Variable name (optional)
Memory
s1 "Hello"
s1 "Hello"
Variable
points to
Object still
nothing...
exists in
memory
Memory
s1 "Hello"
"World"
Memory
s1 "Hello"
s2 "World"
⚫It deletes such objects from memory to free space for new
objects
Memory Memory
s1 "Hello"
GC
s2 "World" "World"
⚫Reference equality x == y
–Checks if the variables reference the same object in memory
s1 == s3 is FALSE s2 "World"
even though the strings are the same
"World"
s3
s1 == s3 FALSE "World"
s1.equals(s2) TRUE
s3
s1.equals(s3) TRUE
if (condition) { if (a == b) {
doMethod();
} }
else if (another condition) { else if (isJava()) {
a = 10;
} }
else { else {
out.println("X");
} }
do {
// loop these statements
do while means that the
}
statements will always
while (condition);
been executed at least
once
int i = 0 ;
while (i < 10) {
System.out.println(i); for is a alternative way
to write a while loop
i++;
}
switch (choice)
{ What happens now
case 'Y':
when choice equals 'Y'?
doThing();
case 'N';
case 'X';
What about 'X'?
exitProgram();
break;
default:
showHelp();
}
⚫ https://docs.oracle.com/en/java/javase/19/language/java-language-changes.html