Java Lesson 1: Basics - Notes
1. What is Java?
Java is a high-level, object-oriented, platform-independent programming
language developed by James Gosling at Sun Microsystems in 1995.
2. Features of Java:
- Simple: Easy to learn
- Object-Oriented: Everything is treated as an object
- Platform Independent: Write Once, Run Anywhere (WORA)
- Secure: No pointers, memory management by JVM
- Robust: Exception handling and garbage collection
- Multithreaded: Can run multiple threads (lightweight processes)
- Portable: Runs on any device with Java Virtual Machine (JVM)
3. Java Terminologies:
- JDK (Java Development Kit): Contains tools to develop Java programs.
- JRE (Java Runtime Environment): Helps run Java programs.
- JVM (Java Virtual Machine): Executes Java bytecode and makes it platform
independent.
4. First Java Program:
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, Java!");
}
Explanation:
- public class HelloWorld: Class declaration
- public static void main(String[] args): Entry point of program
- System.out.println: Prints output to console
Important Questions (Exam Prep):
1. What is Java? Why is it platform independent?
2. Explain features of Java.
3. Difference between JDK, JRE, and JVM.
4. Write and explain a simple Java program.