Answer
What is Java?
Java is a high-level, class-based, object-oriented programming language designed to have as few implementation dependencies as possible. It was developed by James Gosling at Sun Microsystems in 1995.
Key Features of Java
1. Platform Independent — "Write Once, Run Anywhere (WORA)"
Java code compiles to bytecode (.class files), not machine code. The JVM (Java Virtual Machine) on any OS can run the same bytecode.
Java Code (.java)
↓ javac compiler
Bytecode (.class)
↓ JVM
Runs on Windows / Linux / Mac
2. Object-Oriented
Everything in Java is an object. Supports: Inheritance, Encapsulation, Polymorphism, Abstraction.
3. Strongly Typed
Every variable must have a declared type. Type mismatch = compile-time error.
4. Automatic Memory Management
The Garbage Collector (GC) automatically frees unused objects — no manual memory management like C/C++.
5. Multithreading
Java has built-in support for concurrent programming via Thread class and Runnable interface.
6. Robust and Secure
- ✓Compile-time and runtime error checking
- ✓No pointer arithmetic (prevents memory corruption)
- ✓Built-in exception handling
7. Rich Standard Library
Java provides a vast API: Collections, I/O, Networking, Concurrency, JDBC, and more.
JDK vs JRE vs JVM
| Component | Full Form | Purpose |
|---|---|---|
| JDK | Java Development Kit | For developers — includes compiler (javac), JRE, debugging tools |
| JRE | Java Runtime Environment | For running Java apps — includes JVM + libraries |
| JVM | Java Virtual Machine | Executes bytecode on the specific OS |
JDK ⊃ JRE ⊃ JVM
Why Java for QA/SDET?
- ✓Selenium WebDriver is written in Java
- ✓TestNG, JUnit, Rest Assured, Cucumber all use Java
- ✓Most enterprise automation frameworks are Java-based
- ✓Strong type system catches bugs at compile time, not runtime
