Java Fundamentals – Part 1
Learning Roadmap
Programming → Java → History → Founder → Features → Platform → JDK/JRE/JVM →
Compilation → Data Types
What is Programming?
Programming is the process of writing instructions that tell a computer what to do. Java
source code is compiled into bytecode and executed by the JVM.
What is Java?
Java is a high-level, object-oriented, class-based programming language created at Sun
Microsystems. Its famous principle is Write Once, Run Anywhere (WORA).
History
1991: Green Project started
James Gosling created Oak
1995: Renamed to Java and released
2010: Oracle acquired Sun Microsystems.
Visual Timeline
1991 ■■ Green Project
■
James Gosling creates Oak
■
1995 ■■ Java Released ■
■
2010 ■■ Oracle acquires Sun
JDK, JRE and JVM
JDK
■■■ javac (Compiler)
■■■ JRE
■ ■■■ JVM
■ ■■■ Libraries
■■■ Development Tools
Feature JDK JRE JVM
Develop ✔ ✘ ✘
Compile ✔ ✘ ✘
Run ✔ ✔ ✔
Contains JVM ✔ ✔ Self
Java Execution Flow
[Link]
↓
javac
↓
[Link] (Bytecode)
↓
JVM
↓
Machine Code
↓
Output
Primitive Data Types
Type Size Example
byte 1 byte byte b=10;
short 2 bytes short s=100;
int 4 bytes int i=1000;
long 8 bytes long l=100L;
float 4 bytes float f=10.5f;
double 8 bytes double d=10.5;
char 2 bytes char c='A';
boolean true/false boolean ok=true;
Visual Classification
Data Types ■■■ Primitive ■ ■■■ byte ■ ■■■ short ■ ■■■ int ■ ■■■ long
■ ■■■ float ■ ■■■ double ■ ■■■ char ■ ■■■ boolean ■■■ Reference ■■■
String ■■■ Arrays ■■■ Objects ■■■ Classes
Interview Questions
1. What is Java?
2. Why is Java platform independent?
3. Differentiate JDK, JRE and JVM.
4. What is bytecode?
5. List all primitive data types.
6. Explain type casting.