{"id":20003239,"url":"https://github.com/mbrsagor/java","last_synced_at":"2025-10-19T21:40:26.907Z","repository":{"id":111135550,"uuid":"322275356","full_name":"mbrsagor/java","owner":"mbrsagor","description":"Java OOP","archived":false,"fork":false,"pushed_at":"2021-06-24T20:44:29.000Z","size":43745,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-02T00:26:34.412Z","etag":null,"topics":["java","java-8","object","object-oriented","oop"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mbrsagor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-17T11:34:00.000Z","updated_at":"2021-06-24T20:44:32.000Z","dependencies_parsed_at":"2023-06-02T21:00:10.323Z","dependency_job_id":null,"html_url":"https://github.com/mbrsagor/java","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mbrsagor/java","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbrsagor%2Fjava","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbrsagor%2Fjava/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbrsagor%2Fjava/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbrsagor%2Fjava/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mbrsagor","download_url":"https://codeload.github.com/mbrsagor/java/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbrsagor%2Fjava/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279919867,"owners_count":26244333,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-19T02:00:07.647Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","java-8","object","object-oriented","oop"],"created_at":"2024-11-13T05:24:44.743Z","updated_at":"2025-10-19T21:40:26.888Z","avatar_url":"https://github.com/mbrsagor.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Java OOP\n\n\u003e Java OOP concepts.\n\nThere are four main OOP concepts in Java. OOP concepts in Java are the main ideas behind Java’s Object Oriented Programming.\n\n### Table of contents:\n\n- OOP\n- Class\n- Object\n- Constructor\n- Inheritance\n- Encapsulation\n- Polymorphism\n- Abstraction\n- Interface\n\n###### What is Class?\n\n\u003e Ans: `Class` is a blueprint for creating objects.\n\n```java\nclass Sagor{\n    public static void main(String[] args){\n        System.out.println(\"Hello Sagor\");\n    }\n  }\n```\n\n###### What is Object?\n\n\u003e Ans: `Object` is a real data in class or `Object` is an instance of a class.\n\n```java\nSagor ReferenceVariable = new Sagor();\n```\n\n###### What is Inheritance?\n\n\u003e Inheritance is a mechanism in which one class acquires the property of another class. For example, a child inherits the traits of his/her parents. With inheritance, we can reuse the fields and methods of the existing class. Hence, inheritance facilitates Reusability and is an important concept of OOPs.\n\n```java\nclass MbrSagor extends Sagor {\n  // body of the class\n}\n```\n\n###### What is Polymorphism?\n\n\u003e The word polymorphism means having many forms. In simple words, we can define polymorphism as the ability of a message to be displayed in more than one form.\n\n###### What is Interface?\n```java\n// Interface\ninterface Animal {\n  public void animalSound(); // interface method (does not have a body)\n  public void sleep(); // interface method (does not have a body)\n}\n\n// Pig \"implements\" the Animal interface\nclass Pig implements Animal {\n  public void animalSound() {\n    // The body of animalSound() is provided here\n    System.out.println(\"The pig says: wee wee\");\n  }\n  public void sleep() {\n    // The body of sleep() is provided here\n    System.out.println(\"Zzz\");\n  }\n}\n\nclass Main {\n  public static void main(String[] args) {\n    Pig myPig = new Pig();  // Create a Pig object\n    myPig.animalSound();\n    myPig.sleep();\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbrsagor%2Fjava","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmbrsagor%2Fjava","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbrsagor%2Fjava/lists"}