Object Oriented Topics in Java

Lets enumerate some object oriented programming concepts.

1.) Encapsulation – This is the concept where we design classes that exposes only its functionality. When using this class, we can only access its public methods. Implementation, fields and other private methods of this class are encapsulated. In a shorter explanation, as a user of this class, we only need to use what the class can do, we just don’t mind how it is implemented.

2.) Method Override – change the method as it is implemented by its inherited class. Override methods can only be declared on the child class where it has inherited this method. It can have the same parameters, and same return , but of course… with different implementation.

3.) Method Overload – Make a lot of methods with the same name but with different parameters. This method exists in the same class. Very useful to create multiple implementations of the same functionality.

4.) Inheritance – Upon declaring a class, we can inherit all methods and fields of another class ( which in this case, will be called Parent class ), using the keyword “extends”. In this new class we can use the methods of the parent class, even if it is not defined in the inherited ( called Child ) Class.

5.) Polymorphism – In relation to Inheritance, the Child class is also the Parent class, and it is also the Child class. It has two characteristics, which is Polymorphism in this case.

6.) Abstraction – Classes that are declared abstract could not be instantiated, but it must be inherited so it can be used.

7.) Interface – It is a class that only has fields and methods, No implementation. The implementing class, which uses the key word “implements” will mandatory implement the defined methods.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s