Java Programming
☕ Hi guys!
Thanks for the amazing response on the last post. Let's start our Java Programming Fundamentals series
Day 1: Introduction to Java Programming
1. What is Java?
Java is a high-level, object-oriented programming language used to develop different types of applications.
It was developed by James Gosling and his team at Sun Microsystems and officially released in 1995.
Java is widely used for:
• Web applications
• Android applications
• Enterprise software
• Banking applications
• Desktop applications
• Cloud-based applications
• Backend development
• Big data applications
Example: Many enterprise banking systems use Java for backend processing and business logic.
2. Features of Java
Let's understand the important features of Java.
1. Platform Independent
Java follows the principle of "Write Once, Run Anywhere."
You can write Java code on Windows and run the compiled program on Linux or macOS, provided a compatible JVM is available.
2. Object-Oriented
Java organizes programs using classes and objects.
It supports concepts such as:
• Encapsulation
• Inheritance
• Polymorphism
• Abstraction
3. Simple
Java has a relatively straightforward syntax, especially for beginners familiar with programming concepts.
4. Secure
Java provides security features such as bytecode verification, access controls and runtime checks.
5. Robust
Java supports exception handling and automatic memory management, helping developers build reliable applications.
6. Multithreaded
Java allows multiple threads to execute concurrently, helping applications perform multiple tasks.
7. Portable
Java bytecode can run on different platforms with compatible JVM implementations.
3. JDK, JRE and JVM
These are three important terms every Java beginner should understand.
JVM (Java Virtual Machine)
• Executes Java bytecode.
• Converts bytecode into machine instructions during execution.
• Manages memory.
• Supports garbage collection.
JRE (Java Runtime Environment)
• Provides the environment required to run Java applications.
• Includes the JVM and runtime libraries.
JDK (Java Development Kit)
• Provides tools required to develop Java applications.
• Includes the runtime environment and development tools such as the Java compiler.
JDK = Development tools + Runtime
JRE = JVM + Runtime libraries
JVM = Executes Java bytecode
4. How Java Code Is Executed
Let's understand how Java works internally.
Step 1: Write Java source code in a file.
Example: HelloWorld.java
Step 2: Compile the source code using the Java compiler.
Step 3: The compiler generates bytecode in a .class file.
Step 4: JVM loads and executes the bytecode.
Example:
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
Compilation:
javac HelloWorld.java
Execution:
java HelloWorld
Output:
Hello, World!
❤1
1 · 236 ·