Java Complete Guide ☕

OOP + Backend + Interview Prep

1. Introduction

Java is a high-level, object-oriented programming language used in backend systems, Android apps, and enterprise software.

public class Main {
    public static void main(String[] args) {
        System.out.println("Hello Java");
    }
}

2. Variables

int age = 18;
String name = "Sasank";
double price = 99.5;

3. Data Types

int, float, double, char, boolean, String

4. Conditions

int age = 18;

if(age >= 18){
    System.out.println("Adult");
}else{
    System.out.println("Minor");
}

5. Loops

for(int i=0; i<5; i++){
    System.out.println(i);
}

6. Methods

class Test {
    static void greet(){
        System.out.println("Hello");
    }
}

7. OOP Concepts

class Person {
    String name;

    Person(String name){
        this.name = name;
    }
}

8. Inheritance

class A {
    void show(){
        System.out.println("A class");
    }
}

class B extends A {}

9. Polymorphism

class A {
    void show(){
        System.out.println("Parent");
    }
}

10. Exception Handling

try {
    int x = 10/0;
} catch(Exception e){
    System.out.println("Error");
}

11. Arrays

int[] arr = {1,2,3};

for(int i : arr){
    System.out.println(i);
}

12. Mini Project

# Simple Calculator Idea
- Add numbers
- Subtract numbers
- Multiply numbers