Java Basic - Learning Project
A comprehensive Java learning repository covering fundamental to intermediate concepts with practical examples and exercises.
๐ Project Overview
This repository contains organized Java code examples and exercises for learning Java programming from basic concepts to object-oriented programming, GUI development, and collections.
๐๏ธ Project Structure
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
๐ Topics Covered
1. Basic Concepts
- Variables and data types
- Operators (arithmetic, logical, relational)
- Input/Output operations
- Basic syntax and structure
2. Control Statements
- If-else statements
- Switch-case statements
- Ternary operators
- Conditional logic
3. Loops
- For loops
- While loops
- Do-while loops
- Enhanced for loops (for-each)
- Nested loops
4. Arrays
- One-dimensional arrays
- Two-dimensional arrays
- Array operations and manipulations
- Array exercises
5. Functions/Methods
- Method declaration and calling
- Parameters and return types
- Method overloading
- Block functions
- Date functions
6. Object-Oriented Programming (OOP)
- Classes and Objects
- Constructors
- Encapsulation
- Inheritance (Hierarchical, Multilevel, Multiple)
- Polymorphism
- Method Overriding
7. Collections Framework
- HashTable
- ArrayList
- Vector
- Collection operations
8. GUI Development
- AWT (Abstract Window Toolkit)
- Swing components
- Event handling
- Forms and layouts
- Login forms
- Data management interfaces
๐ Getting Started
Prerequisites
- Java Development Kit (JDK) 8 or higher
- Any Java IDE (IntelliJ IDEA, Eclipse, NetBeans, or VS Code with Java extensions)
Running the Examples
-
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
main method
- Right-click and select "Run"
๐ก Example Programs
Basic Arithmetic Operations
// Located in: src/basic/Firstprogram.java
// Demonstrates basic arithmetic operations
Student Grade System
// Located in: src/oop/basic/class_object.java
// Calculates student grades based on scores
Array Operations
// Located in: src/array/
// Various array manipulation examples
GUI Applications
// Located in: src/form/AWT/
// Login forms, person lists, and data management
๐ Key Features
- โ
Well-organized code structure
- โ
Practical exercises and examples
- โ
Progressive difficulty levels
- โ
Real-world application examples
- โ
GUI development samples
- โ
Comprehensive OOP demonstrations
๐ฏ Learning Path
- 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/, and src/form/ - Create user interfaces
๐ ๏ธ IDE Setup
IntelliJ IDEA
- Open IntelliJ IDEA
- Select "Open" and choose the
java-basic folder
- Wait for the project to index
- Right-click any file with a main method and select "Run"
Visual Studio Code
- Install the "Extension Pack for Java" from the marketplace
- Open the
java-basic folder
- Use the Run button or press F5 to execute files
๐ Additional Resources
๐ค Contributing
This is a personal learning project. Feel free to fork and create your own versions for learning purposes.
๐ License
This project is open source and available for educational purposes.
๐ค Author
Serey Panha
๐
Last Updated
October 2025
Happy Coding! ๐