Skip to content

This is JAVA OOPs Course ( in 1 file ) with Source Code that will teach you about concepts of java oops from basics. But make sure that you read our Java Course Resporatory : (https://github.com/saqlainwebdeveloper/java-in-one-file.git)

Notifications You must be signed in to change notification settings

saqlainwebdeveloper/oops-java-in-1-file

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

OOPs in Java 🚀

This repository contains Object-Oriented Programming (OOPs) examples in Java.
It demonstrates different OOPs concepts like:

  • Classes & Objects
  • Constructors
  • Copy Constructors
  • Method Overloading
  • Inheritance (Single, Multi-level, Hierarchical, Hybrid)
  • Interfaces
  • Real-world examples (Employee, Hacker, Car, Student, User, etc.)
  • Small Java Programs (like FizzBuzz + Prime Numbers)

👨‍💻 Author Introduction

Hello! I am Muhammad Saqlain Shoukat also known as Dark Wolf founder and developer of Coding Chat Room, a passionate learner and creator in the field of Web Development, Cybersecurity, Programming, and DevSecOps.

🔹 My mission is to make complex technical concepts simple and easy so that students and professionals can learn without confusion.
🔹 On my platforms, I share tutorials, study notes, and practical tips about Linux, Ethical Hacking, Development, Programming and Cybersecurity.
🔹 I believe in learning by sharing — the more we teach, the more we grow.


📂 Project Structure

  • Employee, Hacker, Car, Student, User → Basic OOPs examples
  • Unknown → Method Overloading examples
  • StudentGradingSystem → Conditional logic with OOP
  • Shape, Circle, Animal, Fruit, Weapon → Inheritance examples
  • Oops.java → Main file to run different code snippets

🔑 FizzBuzz + Prime Program

One special program included here is a modified FizzBuzz that also checks for prime numbers:

public class Oops {
    public static void main(String[] args) {
        for (int i = 1; i <= 100; i++) {
            if (i % 3 == 0 && i % 5 == 0) {
                System.out.println(i + ":" + " FizzBuzz");
            } else if (i % 3 == 0) {
                System.out.println(i + ":" + " Fizz");
            } else if (i % 5 == 0) {
                System.out.println(i + ":" + " Buzz");
            } else if (prime(i)) {
                System.out.println(i + ":" + " Prime");
            }
        }
    }

    public static boolean prime(int num) {
        if (num <= 1) {
            return false;
        }
        for (int i = 2; i <= num / 2; i++) {
            if (num % i == 0) {
                return false;
            }
        }
        return true;
    }
}

▶️ How to Run

  1. Clone or download this repository.
  2. Open in VS Code / IntelliJ / Eclipse or any Java IDE.
  3. Compile and run:
javac Oops.java
java Oops

📌 Output Example

2: Prime
3: Fizz
5: Buzz
7: Prime
11: Prime
15: FizzBuzz
17: Prime
23: Prime
29: Prime
...

📚 More Learning & Connect with Me

If you found this helpful and want to learn more about web development, programming, and resources, follow me here and Star this Resporatory:

💡 I share tutorials, tips, and resources to make learning cybersecurity and coding easier.
Don’t forget to subscribe & follow for more updates and Star this Resporatory 🚀


Learning and practicing Java OOPs concepts step by step.

About

This is JAVA OOPs Course ( in 1 file ) with Source Code that will teach you about concepts of java oops from basics. But make sure that you read our Java Course Resporatory : (https://github.com/saqlainwebdeveloper/java-in-one-file.git)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages