Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

petsereypanha/basic-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

37 Commits

Repository files navigation

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

  1. Clone or download the repository

    git clone https://github.com/petsereypanha/basic-java.git
    cd java-basic
  2. Compile a Java file

    javac src/basic/Firstprogram.java
  3. Run the compiled class

    java -cp src basic.Firstprogram
  4. 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

  1. Start with src/basic/ - Learn fundamental Java syntax
  2. Move to src/control_statement/ - Understand program flow
  3. Practice with src/loop/ - Master iteration
  4. Explore src/array/ - Work with data structures
  5. Study src/function/ - Learn modular programming
  6. Deep dive into src/oop/ - Master object-oriented concepts
  7. Experiment with src/collection/ - Use Java collections
  8. Build GUIs with src/awt/, src/swing/, and src/form/ - Create user interfaces

πŸ› οΈ IDE Setup

IntelliJ IDEA

  1. Open IntelliJ IDEA
  2. Select "Open" and choose the java-basic folder
  3. Wait for the project to index
  4. Right-click any file with a main method and select "Run"

Visual Studio Code

  1. Install the "Extension Pack for Java" from the marketplace
  2. Open the java-basic folder
  3. 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! πŸš€

Releases

No releases published

Packages

No packages published

Languages

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /