Data Analytics
27K subscribers
1.16K photos
24 videos
26 files
977 links
Dive into the world of Data Analytics – uncover insights, explore trends, and master data-driven decision making.
Download Telegram
# πŸ“š 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 .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
❀4