
Java Programming
June 13, 2025 at 05:59 AM
☕ *Java Fundamentals – Must-Know Basics for Every Beginner*
1️⃣ *Java Syntax & Structure*
• Java programs are written in *classes*.
• Code starts from the `main()` method:
```
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
```
2️⃣ *Data Types*
• *Primitive:* int, float, double, char, boolean, byte, short, long
• *Non-Primitive:* String, Arrays, Classes
3️⃣ *Variables & Operators*
• Variable example: `int age = 25;`
• Operators: +, -, *, /, %, ++, --, ==, !=, &&, ||
4️⃣ *Control Statements*
• *if-else:*
```
if (a > b) {
System.out.println("A is greater");
}
```
• *switch-case:*
```
switch(day) {
case 1: System.out.println("Mon"); break;
}
```
• *Loops:* for, while, do-while
5️⃣ *Input & Output*
• Input using Scanner:
```
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
```
• Output using `System.out.println()`
🟢 *Master these fundamentals to build a strong foundation in Java!*
*React ❤️ for OOP concepts next!*
❤️
❤
👍
♥
😢
🥰
57