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! π