Introduction to Java
Learn the fundamentals of Java programming and understand why Java is one of the most widely used programming languages.
What is Java?
Java is a high-level, object-oriented, class-based programming language designed to be simple, secure, portable, and reliable. It was originally developed at Sun Microsystems and is now maintained by Oracle.
Java follows the principle of Write Once, Run Anywhere (WORA). Java programs are compiled into bytecode, which can run on any system that has a compatible Java Virtual Machine (JVM).
Why Learn Java?
Platform Independent
Java bytecode can run on different operating systems using the Java Virtual Machine.
Object-Oriented
Java supports classes, objects, inheritance, polymorphism, abstraction, and encapsulation.
Secure
Java provides features such as strong type checking, runtime verification, and controlled memory management.
Automatic Memory Management
Java uses automatic garbage collection to manage unused objects.
Key Features of Java
- Simple and easy to learn
- Object-oriented
- Platform independent
- Secure
- Robust
- Multithreaded
- Portable
- High performance with JIT compilation
- Automatic garbage collection
Java Platform Components
| Component | Description |
|---|---|
| JDK | Java Development Kit provides tools required to develop and compile Java applications. |
| JRE | Java Runtime Environment provides the environment required to run Java applications. |
| JVM | Java Virtual Machine executes Java bytecode on the target operating system. |
How Java Works
A Java source file normally has the
.java extension.
The Java compiler converts the source code into bytecode.
Java Source Code
↓
javac Compiler
↓
Bytecode (.class)
↓
JVM
↓
Operating System / Hardware
The JVM interprets or JIT-compiles the bytecode into machine instructions that can be executed by the system.
Simple Java Program
public class Simple {
public static void main(String[] args) {
System.out.println("Wel-Come CIIT Institute🤓....!");
}
}
Understanding the Program
| Code | Purpose |
|---|---|
public class Simple
|
Defines a Java class named Simple. |
public static void main(String[] args)
|
Defines the main method, which is the entry point of a traditional Java application. |
System.out.println()
|
Prints text to the console. |
Where is Java Used?
- Enterprise applications
- Backend development
- Banking and financial systems
- Android application development
- Cloud applications
- Distributed systems
- Big data technologies
- Web applications
Summary
Java is a powerful, object-oriented and platform-independent programming language. Understanding Java fundamentals, the JVM, JDK, JRE, and basic program structure provides the foundation for learning advanced Java development.