Skip to content

In this project I introduced Object Oriented Programming. I learned Constructor , Inheritance, Encapsulation, Polymorphism, Abstract and Interface.

Notifications You must be signed in to change notification settings

salihkertik/OOP

Repository files navigation

OOP

Basic Project - Learning Process

In this project I introduced Object Oriented Programming. I learned Constructor , Inheritance, Encapsulation, Polymorphism, Abstract and Interface.

Bu projede Nesneye Yönelik Programlamaya giriş yaptım. Constructor , Inheritance, Encapsulation, Polymorphism, Abstract ve Interface yapılarını öğrendim.

// Information about OOP is as follows.

Constructor

A constructor in Java is a special method that is used to initialize objects. The constructor is called when an object of a class is created.

Inheritance

Inheritance in Java is a mechanism in which one object acquires all the properties and behaviors of a parent object. It is an important part of OOPs (Object Oriented programming system). The idea behind inheritance in Java is that you can create new classes that are built upon existing classes.

Encapsulation

Encapsulation is one of the four fundamental OOP concepts. The other three are inheritance, polymorphism, and abstraction.

Encapsulation in Java is a mechanism of wrapping the data (variables) and code acting on the data (methods) together as a single unit. In encapsulation, the variables of a class will be hidden from other classes, and can be accessed only through the methods of their current class. Therefore, it is also known as data hiding.

To achieve encapsulation in Java

-Declare the variables of a class as private.

-Provide public setter and getter methods to modify and view the variables values.

Polymorphism

In Java, polymorphism refers to the ability of a class to provide different implementations of a method, depending on the type of object that is passed to the method. To put it simply, polymorphism in Java allows us to perform the same action in many different ways.

Abstract

The abstract keyword is a non-access modifier, used for classes and methods: Abstract class: is a restricted class that cannot be used to create objects (to access it, it must be inherited from another class). Abstract method: can only be used in an abstract class, and it does not have a body.

Interface

An interface in Java is a blueprint of a class. It has static constants and abstract methods. The interface in Java is a mechanism to achieve abstraction. There can be only abstract methods in the Java interface, not method body.

About

In this project I introduced Object Oriented Programming. I learned Constructor , Inheritance, Encapsulation, Polymorphism, Abstract and Interface.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages