Java Programming
Java Programming
June 11, 2025 at 01:29 PM
💻 *Top 10 Java Concepts with Examples* ☕🚀 1️⃣ *Variables and Data Types* ```java int age = 25; String name = "John"; ``` 2️⃣ *Methods (Functions)* ```java public static String greet(String name) { return "Hello " + name; } ``` 3️⃣ *Arrays* ```java int[] numbers = {1, 2, 3, 4}; System.out.println(numbers[0]); // 1 ``` 4️⃣ *Objects and Classes* ```java class Person { String name; int age; } ``` 5️⃣ *Loops (for, while, for-each)* ```java for(int i = 0; i < 5; i++) { System.out.println(i); } ``` 6️⃣ *Conditionals (if, else, switch)* ```java if(age > 18) { System.out.println("Adult"); } else { System.out.println("Minor"); } ``` 7️⃣ *Inheritance* ```java class Animal { void speak() { System.out.println("Sound"); } } class Dog extends Animal { void speak() { System.out.println("Bark"); } } ``` 8️⃣ *Interfaces* ```java interface Drawable { void draw(); } class Circle implements Drawable { public void draw() { System.out.println("Drawing circle"); } } ``` 9️⃣ *Exception Handling* ```java try { int result = 10 / 0; } catch (ArithmeticException e) { System.out.println("Cannot divide by zero"); } ``` 🔟 *Collections (ArrayList, HashMap)* ```java ArrayList list = new ArrayList<>(); list.add("Java"); HashMap map = new HashMap<>(); map.put("Age", 30); ``` 🔥 *React ❤️ for more Java concepts!*
❤️ 👍 🔥 ❤‍🔥 😭 🆒 💚 😂 118

Comments