Notes – Introduction to Java
What is Java?
Java is a high-level, object-oriented programming language developed by Sun Microsystems in 1995. It is designed to be platform-independent, meaning code written in Java can run on any system that has a Java Virtual Machine (JVM).
Key Features of Java
- Platform Independence – Java follows the “Write Once, Run Anywhere” (WORA) principle. Programs compiled in Java can run on any operating system with a JVM.
- Object-Oriented – Java is built around classes and objects, making code reusable and modular.
- Robust and Secure – Java provides strong memory management and security features like bytecode verification and exception handling.
- Multi-threading – Java allows execution of multiple tasks simultaneously, improving efficiency.
- Automatic Memory Management – Java handles memory allocation and deallocation using Garbage Collection (GC), reducing manual effort.
Why Learn Java?
- Widely Used – Java is used in web applications, mobile apps, enterprise solutions, and even in AI and big data.
- Beginner-Friendly – Java has a simple and readable syntax, making it great for beginners.
- Strong Community Support – Millions of developers worldwide contribute to Java, providing libraries, frameworks, and solutions.
- Job Opportunities – Java is a core requirement in many tech job roles, including Java Developer, Full Stack Developer, and Android Developer.
Java vs. Other Programming Languages
| Feature | Java | C++ | Python |
|---|---|---|---|
| Platform Independence | Yes (JVM-based) | No | Yes (Interpreter-based) |
| Object-Oriented | Fully | Partially | Fully |
| Memory Management | Automatic (Garbage Collection) | Manual | Automatic |
| Syntax Complexity | Moderate | Complex | Easy |
| Performance | High | Very High | Moderate |
How Java Works?
- Write Code – Java code is written in
.javafiles. - Compile Code – The Java Compiler (
javac) converts code into bytecode (.classfile). - Execute Code – The Java Virtual Machine (JVM) reads the bytecode and runs the program.
This process ensures that Java programs can run on different platforms without modification.
