A comprehensive Java learning repository covering fundamental to intermediate concepts with practical examples and exercises.
This repository contains organized Java code examples and exercises for learning Java programming from basic concepts to object-oriented programming, GUI development, and collections.
java-basic/
├── src/
│ ├── array/ # Array operations and exercises
│ ├── awt/ # AWT (Abstract Window Toolkit) examples
│ ├── basic/ # Basic Java syntax and operations
│ ├── collection/ # Java Collections Framework examples
│ ├── control_statement/ # If-else, switch-case, ternary operators
│ ├── form/ # GUI form examples
│ │ ├── AWT/ # AWT form implementations
│ │ ├── MarketForm/ # Market management forms
│ │ └── StaffForm/ # Staff management forms
│ ├── function/ # Function/method examples
│ ├── loop/ # Loop structures (for, while, do-while, enhanced for)
│ ├── oop/ # Object-Oriented Programming concepts
│ │ ├── basic/ # Classes, objects, constructors
│ │ ├── HashTable/ # HashTable implementations
│ │ ├── Inheritances/ # Inheritance examples
│ │ ├── Polymorphism/ # Polymorphism demonstrations
│ │ └── overide/ # Method overriding examples
│ ├── swing/ # Swing GUI components
│ └── test_mouse/ # GUI interaction examples
└── Main.java # Entry point
- Variables and data types
- Operators (arithmetic, logical, relational)
- Input/Output operations
- Basic syntax and structure
- If-else statements
- Switch-case statements
- Ternary operators
- Conditional logic
- For loops
- While loops
- Do-while loops
- Enhanced for loops (for-each)
- Nested loops
- One-dimensional arrays
- Two-dimensional arrays
- Array operations and manipulations
- Array exercises
- Method declaration and calling
- Parameters and return types
- Method overloading
- Block functions
- Date functions
- Classes and Objects
- Constructors
- Encapsulation
- Inheritance (Hierarchical, Multilevel, Multiple)
- Polymorphism
- Method Overriding
- HashTable
- ArrayList
- Vector
- Collection operations
- AWT (Abstract Window Toolkit)
- Swing components
- Event handling
- Forms and layouts
- Login forms
- Data management interfaces
- Java Development Kit (JDK) 8 or higher
- Any Java IDE (IntelliJ IDEA, Eclipse, NetBeans, or VS Code with Java extensions)
-
Clone or download the repository
git clone https://github.com/petsereypanha/basic-java.git cd java-basic -
Compile a Java file
javac src/basic/Firstprogram.java
-
Run the compiled class
java -cp src basic.Firstprogram
-
Or use your IDE
- Open the project in your IDE
- Navigate to any Java file with a
mainmethod - Right-click and select "Run"
// Located in: src/basic/Firstprogram.java
// Demonstrates basic arithmetic operations// Located in: src/oop/basic/class_object.java
// Calculates student grades based on scores// Located in: src/array/
// Various array manipulation examples// Located in: src/form/AWT/
// Login forms, person lists, and data management- ✅ Well-organized code structure
- ✅ Practical exercises and examples
- ✅ Progressive difficulty levels
- ✅ Real-world application examples
- ✅ GUI development samples
- ✅ Comprehensive OOP demonstrations
- Start with
src/basic/- Learn fundamental Java syntax - Move to
src/control_statement/- Understand program flow - Practice with
src/loop/- Master iteration - Explore
src/array/- Work with data structures - Study
src/function/- Learn modular programming - Deep dive into
src/oop/- Master object-oriented concepts - Experiment with
src/collection/- Use Java collections - Build GUIs with
src/awt/,src/swing/, andsrc/form/- Create user interfaces
- Open IntelliJ IDEA
- Select "Open" and choose the
java-basicfolder - Wait for the project to index
- Right-click any file with a main method and select "Run"
- Install the "Extension Pack for Java" from the marketplace
- Open the
java-basicfolder - Use the Run button or press F5 to execute files
This is a personal learning project. Feel free to fork and create your own versions for learning purposes.
This project is open source and available for educational purposes.
Serey Panha
- GitHub: @petsereypanha
October 2025
Happy Coding! 🚀