Java Notes - Part 1: Basics
History & Introduction
- Developed by James Gosling, 1995 (Sun Microsystems).
- Motto: Write Once, Run Anywhere (WORA).
Features of Java
- Simple, Object-Oriented, Secure, Robust, Multithreaded, Distributed.
JVM, JRE, JDK
- JDK: Java Development Kit (compiler, tools).
- JRE: Java Runtime Environment (libraries + JVM).
- JVM: Java Virtual Machine (runs bytecode).
First Java Program
class Hello {
public static void main(String[] args) {
[Link]("Hello, Java!");
}
}
Data Types, Variables, Operators
- Primitive: int, float, double, char, boolean, byte, short, long
- Operators: Arithmetic, Relational, Logical, Assignment
Control Statements
- if, if-else, switch
- Loops: for, while, do-while