A comprehensive collection of Java programs covering fundamental to advanced concepts. Each file is a standalone program demonstrating specific Java features.
- 01-HelloWorld.java - First program, basic structure
- 02-Variables-DataTypes.java - Data types, variables, constants
- 03-Input-Output.java - Scanner, formatted output
- 04-Operators.java - Arithmetic, logical, bitwise operators
- 05-ControlFlow.java - if-else, switch statements
- 06-Loops.java - for, while, do-while, enhanced for
- 07-Methods.java - Method declaration, overloading, recursion
- 08-Arrays.java - Arrays, multidimensional arrays, Arrays class
- 09-Strings.java - String operations, StringBuilder
- 10-OOP-Classes.java - Classes, objects, constructors, encapsulation
- 11-OOP-Inheritance.java - Inheritance, super keyword
- 12-OOP-Polymorphism.java - Method overriding, runtime polymorphism
- 13-Abstract-Interface.java - Abstract classes, interfaces
- 14-Collections-ArrayList.java - ArrayList operations
- 15-Collections-HashMap.java - HashMap, key-value pairs
- 16-ExceptionHandling.java - try-catch, custom exceptions
- 17-FileIO.java - File reading/writing, BufferedReader/Writer
- 18-Generics.java - Generic classes, methods, bounded types
- 19-Lambda-Streams.java - Lambda expressions, Stream API
- 20-Multithreading.java - Threads, Runnable, synchronization
- 21-Enums.java - Enumerations, enum with methods
- 22-Annotations.java - Built-in and custom annotations
- 23-Reflection.java - Reflection API, dynamic class inspection
- 24-DesignPatterns.java - Singleton, Factory, Builder patterns
- 25-Optional.java - Optional class for null safety
# Compile a single file
javac 01-HelloWorld.java
# Run the compiled class
java HelloWorld
# Compile and run in one step (Java 11+)
java 01-HelloWorld.java- Start from 01-HelloWorld.java and progress sequentially
- Read the code comments for explanations
- Compile and run each program
- Modify the code to experiment
- Move to the next file once comfortable
- Fundamentals: Variables, operators, control flow, loops
- Methods: Declaration, overloading, recursion, varargs
- Data Structures: Arrays, ArrayList, HashMap, Strings
- OOP: Classes, inheritance, polymorphism, abstraction, interfaces
- Collections Framework: ArrayList, HashMap, iteration
- Exception Handling: try-catch-finally, custom exceptions
- File I/O: Reading/writing files, BufferedReader/Writer
- Generics: Type-safe collections and methods
- Modern Java: Lambda expressions, Streams, Optional
- Concurrency: Multithreading, synchronization
- Advanced: Enums, Annotations, Reflection, Design Patterns
- Each file is self-contained and can be compiled independently
- Class name must match the filename (e.g., HelloWorld.java contains class HelloWorld)
- Files 01-18 cover core Java concepts
- Files 19-25 require Java 8 or later for modern features
- Practice by modifying examples and creating your own variations
- JDK 8 or later (Java Development Kit)
- Text editor or IDE (VS Code, IntelliJ IDEA, Eclipse)
- Command line or terminal
- Java is case-sensitive
- Each public class must be in its own file
- File name must match the public class name
- Use
javacto compile,javato run
Happy Learning! 🎓