Skip to content

kanomoo/java-oop-assignments

Repository files navigation

Java OOP Assignments and Examples

Java in class — Java OOP examples, exercises and classroom assignments used for teaching and learning object-oriented programming in Java.

คำอธิบาย (ภาษาไทย)

รวมตัวอย่างโค้ด แบบฝึกหัด และงานมอบหมายในวิชา Java OOP เพื่อการศึกษาและฝึกปฏิบัติ

Overview

This repository contains:

  • Classroom assignments and solutions (see src/ and bin/)
  • Example projects demonstrating OOP concepts (encapsulation, inheritance, polymorphism, interfaces)
  • Sample data files used in exercises (Students.txt, products.csv, sales.csv)

Quick repository metadata (suggested)

  • Description: Java in class — Java OOP examples
  • Website: replace with your project URL
  • Topics: java oop examples classroom
  • Enable GitHub features: Releases, Deployments, Packages when you publish

Prerequisites

  • Java JDK 8 or later
  • Optional: Visual Studio Code with the Java Extension Pack

Installation and setup

  1. Clone the repository:
git clone <repo-url>
cd java_in_class
  1. Open the folder in Visual Studio Code (recommended) or your preferred IDE.

Build & run (command line)

Compile all sources into bin/:

javac -d bin $(find src -name "*.java")

On Windows (PowerShell / cmd), you can run:

javac -d bin src\**\*.java

Run a main class (replace <MainClass> with the fully-qualified class name):

java -cp bin com.example.Main

If a class is in the default package and files are at the root of src/, run:

javac -d bin src\Main.java
java -cp bin Main

Using Visual Studio Code

  • Install Extension Pack for Java (by Microsoft) for editor support, debugging and project management.
  • Use the Run code lens above main() methods or the JAVA PROJECTS view to compile and run classes.

Running examples and assignments

  • Each chapter or assignment is organized under src/ and mirrored in bin/ after compilation.
  • Example: to run an assignment Ass2_01.java located at src/Ass2/Ass2_01.java:
javac -d bin src/Ass2/Ass2_01.java
java -cp bin Ass2.Ass2_01

If the code uses packages, use the package-qualified class name in the java command.

Quick demo (runnable example)

An example Main demonstrating basic OOP is provided at src/example/Main.java (package example). To compile and run this demo:

Unix / WSL / Git Bash:

javac -d bin src/example/Main.java
java -cp bin example.Main

Windows (cmd / PowerShell):

java-oop-assignments

Comprehensive collection of Java OOP assignments, examples and classroom exercises for learning object-oriented programming in Java.

คำอธิบาย (ภาษาไทย)

รวมงานมอบหมาย ตัวอย่าง และแบบฝึกหัด Java OOP เพื่อการเรียนการสอนและฝึกปฏิบัติ

Table of Contents

  • Overview
  • Quick start
  • Demo (runnable example)
  • Project structure
  • Contributing
  • License

Overview

This repository contains:

  • Assignments and solutions organized by chapter or assignment folder under src/
  • Small example programs that illustrate OOP concepts: encapsulation, inheritance, polymorphism, interfaces
  • Sample data files used in exercises (Students.txt, products.csv, sales.csv)

Quick start

Requirements:

  • Java JDK 8 or later
  • Optional: Visual Studio Code with the Java Extension Pack

Clone and build:

git clone <repo-url>
cd java-oop-assignments

Compile all Java sources to bin/ (Unix):

javac -d bin $(find src -name "*.java")

Windows (PowerShell / cmd):

javac -d bin src\**\*.java

Run a class (replace with the fully-qualified class name):

java -cp bin package.name.MainClass

Demo (runnable example)

There is a small demo in src/example/Main.java (package example). To compile and run it:

Unix / WSL / Git Bash:

javac -d bin src/example/Main.java
java -cp bin example.Main

Windows (cmd / PowerShell):

javac -d bin src\example\Main.java
java -cp bin example.Main

Expected output:

Hi, I'm Alice, age 30.
Hi, I'm student CS101.
Student ID: CS101

Project structure

  • src/ — Java source files (organized by chapter/assignment)
  • bin/ — compiled class files (generated by javac)
  • data/ or root files like Students.txt, products.csv — sample input data
  • LICENSE — project license

Contributing

  1. Fork the repository and create a feature branch.
  2. Add your exercise or solution under src/, include a short description and expected output.
  3. Open a pull request with a clear title and summary.

Coding conventions

  • Use standard Java naming: CamelCase for classes, lowercase for packages.
  • Prefer small, focused methods; include comments for complex logic.

License

This project is licensed under the MIT License — see the LICENSE file for details.

Repository metadata (recommended)

  • Repository name: java-oop-assignments
  • Description: Java OOP assignments, examples and exercises
  • Website: https://github.com//java-oop-assignments
  • Topics: java oop assignments examples classroom

If you'd like, I can set these via the GitHub CLI or create a GitHub Pages demo site.

About

A collection of classroom exercises, sample programs and assignments demonstrating object-oriented programming concepts in Java (encapsulation, inheritance, polymorphism, interfaces).

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages