Java in class — Java OOP examples, exercises and classroom assignments used for teaching and learning object-oriented programming in Java.
รวมตัวอย่างโค้ด แบบฝึกหัด และงานมอบหมายในวิชา Java OOP เพื่อการศึกษาและฝึกปฏิบัติ
This repository contains:
- Classroom assignments and solutions (see
src/andbin/) - Example projects demonstrating OOP concepts (encapsulation, inheritance, polymorphism, interfaces)
- Sample data files used in exercises (
Students.txt,products.csv,sales.csv)
- Description: Java in class — Java OOP examples
- Website: replace with your project URL
- Topics: java oop examples classroom
- Enable GitHub features:
Releases,Deployments,Packageswhen you publish
- Java JDK 8 or later
- Optional: Visual Studio Code with the Java Extension Pack
- Clone the repository:
git clone <repo-url>
cd java_in_class- Open the folder in Visual Studio Code (recommended) or your preferred IDE.
Compile all sources into bin/:
javac -d bin $(find src -name "*.java")On Windows (PowerShell / cmd), you can run:
javac -d bin src\**\*.javaRun a main class (replace <MainClass> with the fully-qualified class name):
java -cp bin com.example.MainIf 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- Install
Extension Pack for Java(by Microsoft) for editor support, debugging and project management. - Use the
Runcode lens abovemain()methods or theJAVA PROJECTSview to compile and run classes.
- Each chapter or assignment is organized under
src/and mirrored inbin/after compilation. - Example: to run an assignment
Ass2_01.javalocated atsrc/Ass2/Ass2_01.java:
javac -d bin src/Ass2/Ass2_01.java
java -cp bin Ass2.Ass2_01If the code uses packages, use the package-qualified class name in the java command.
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.MainWindows (cmd / PowerShell):
Comprehensive collection of Java OOP assignments, examples and classroom exercises for learning object-oriented programming in Java.
รวมงานมอบหมาย ตัวอย่าง และแบบฝึกหัด Java OOP เพื่อการเรียนการสอนและฝึกปฏิบัติ
- Overview
- Quick start
- Demo (runnable example)
- Project structure
- Contributing
- License
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)
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-assignmentsCompile all Java sources to bin/ (Unix):
javac -d bin $(find src -name "*.java")Windows (PowerShell / cmd):
javac -d bin src\**\*.javaRun a class (replace with the fully-qualified class name):
java -cp bin package.name.MainClassThere 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.MainWindows (cmd / PowerShell):
javac -d bin src\example\Main.java
java -cp bin example.MainExpected output:
Hi, I'm Alice, age 30.
Hi, I'm student CS101.
Student ID: CS101
src/— Java source files (organized by chapter/assignment)bin/— compiled class files (generated byjavac)data/or root files likeStudents.txt,products.csv— sample input dataLICENSE— project license
- Fork the repository and create a feature branch.
- Add your exercise or solution under
src/, include a short description and expected output. - Open a pull request with a clear title and summary.
- Use standard Java naming:
CamelCasefor classes,lowercasefor packages. - Prefer small, focused methods; include comments for complex logic.
This project is licensed under the MIT License — see the LICENSE file for details.
- 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.