# π Java Programming Language β Part 1/10: Introduction to Java
#Java #Programming #OOP #Beginner #Coding
Welcome to this comprehensive 10-part Java series! Letβs start with the basics.
---
## πΉ What is Java?
Java is a high-level, object-oriented, platform-independent programming language. Itβs widely used in:
- Web applications (Spring, Jakarta EE)
- Mobile apps (Android)
- Enterprise software
- Big Data (Hadoop)
- Embedded systems
Key Features:
βοΈ Write Once, Run Anywhere (WORA) β Thanks to JVM
βοΈ Strongly Typed β Variables must be declared with a type
βοΈ Automatic Memory Management (Garbage Collection)
βοΈ Multi-threading Support
---
## πΉ Java vs. Other Languages
| Feature | Java | Python | C++ |
|---------------|--------------|--------------|--------------|
| Typing | Static | Dynamic | Static |
| Speed | Fast (JIT) | Slower | Very Fast |
| Memory | Managed (GC) | Managed | Manual |
| Use Case | Enterprise | Scripting | System/Game |
---
## πΉ How Java Works?
1. Write code in
2. Compile into bytecode (
3. JVM (Java Virtual Machine) executes the bytecode
---
## πΉ Setting Up Java
1οΈβ£ Install JDK (Java Development Kit)
- Download from [Oracle] :https://www.oracle.com/java/technologies/javase-downloads.html
- Or use OpenJDK (Free alternative)
2οΈβ£ Verify Installation
3οΈβ£ Set `JAVA_HOME` (For IDE compatibility)
---
## πΉ Your First Java Program
### π Explanation:
-
-
-
### βΆοΈ How to Run?
Output:
---
## πΉ Java Syntax Basics
β Case-Sensitive β
β Class Names β
β Method/Variable Names β
β Every statement ends with `;`
---
## πΉ Variables & Data Types
Java supports primitive and non-primitive types.
### Primitive Types (Stored in Stack Memory)
| Type | Size | Example |
|-----------|---------|----------------|
|
|
|
|
### Non-Primitive (Reference Types, Stored in Heap)
-
- Arrays β
- Classes & Objects
---
### π Whatβs Next?
In Part 2, weβll cover:
β‘οΈ Operators & Control Flow (if-else, loops)
β‘οΈ Methods & Functions
Stay tuned! π
#LearnJava #JavaBasics #CodingForBeginners
#Java #Programming #OOP #Beginner #Coding
Welcome to this comprehensive 10-part Java series! Letβs start with the basics.
---
## πΉ What is Java?
Java is a high-level, object-oriented, platform-independent programming language. Itβs widely used in:
- Web applications (Spring, Jakarta EE)
- Mobile apps (Android)
- Enterprise software
- Big Data (Hadoop)
- Embedded systems
Key Features:
βοΈ Write Once, Run Anywhere (WORA) β Thanks to JVM
βοΈ Strongly Typed β Variables must be declared with a type
βοΈ Automatic Memory Management (Garbage Collection)
βοΈ Multi-threading Support
---
## πΉ Java vs. Other Languages
| Feature | Java | Python | C++ |
|---------------|--------------|--------------|--------------|
| Typing | Static | Dynamic | Static |
| Speed | Fast (JIT) | Slower | Very Fast |
| Memory | Managed (GC) | Managed | Manual |
| Use Case | Enterprise | Scripting | System/Game |
---
## πΉ How Java Works?
1. Write code in
.java files 2. Compile into bytecode (
.class files) using javac 3. JVM (Java Virtual Machine) executes the bytecode
HelloWorld.java β (Compile) β HelloWorld.class β (Run on JVM) β Output
---
## πΉ Setting Up Java
1οΈβ£ Install JDK (Java Development Kit)
- Download from [Oracle] :https://www.oracle.com/java/technologies/javase-downloads.html
- Or use OpenJDK (Free alternative)
2οΈβ£ Verify Installation
java -version
javac -version
3οΈβ£ Set `JAVA_HOME` (For IDE compatibility)
---
## πΉ Your First Java Program
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}### π Explanation:
-
public class HelloWorld β Class name must match the filename (HelloWorld.java) -
public static void main(String[] args) β Entry point of any Java program -
System.out.println() β Prints output ### βΆοΈ How to Run?
javac HelloWorld.java # Compiles to HelloWorld.class
java HelloWorld # Runs the program
Output:
Hello, World!
---
## πΉ Java Syntax Basics
β Case-Sensitive β
myVar β MyVar β Class Names β
PascalCase (MyClass) β Method/Variable Names β
camelCase (myMethod) β Every statement ends with `;`
---
## πΉ Variables & Data Types
Java supports primitive and non-primitive types.
### Primitive Types (Stored in Stack Memory)
| Type | Size | Example |
|-----------|---------|----------------|
|
int | 4 bytes | int x = 10; ||
double | 8 bytes | double y = 3.14; ||
boolean | 1 bit | boolean flag = true; ||
char | 2 bytes | char c = 'A'; |### Non-Primitive (Reference Types, Stored in Heap)
-
String β String name = "Ali"; - Arrays β
int[] nums = {1, 2, 3}; - Classes & Objects
---
### π Whatβs Next?
In Part 2, weβll cover:
β‘οΈ Operators & Control Flow (if-else, loops)
β‘οΈ Methods & Functions
Stay tuned! π
#LearnJava #JavaBasics #CodingForBeginners
Oracle
Download the Latest Java LTS Free
Subscribe to Java SE and get the most comprehensive Java support available, with 24/7 global access to the experts.
β€4