Basic OOP concepts in Java



I know this is too basic, but, sometimes we need to check this basic things out to remember what we are using and why. So here it is my 50 cents about basic Object Oriented Programming concepts. Basically:



  • Superclass: abstracts out common features of other classes
  • Subclass:
    • inherits fields and methods from superclass, except the private ones
    • overrides(existing methods) or extends(create own methods) methods from superclass.
    • a subclass can override a method from the superclass provided that it is not final (if it is static cannot be overridden by redeclared)
    • define changes from superclass
    • Java supports only single inheritance
    • super: invoking a superclass version of an overridden method
    • protected is like private but subclasses can inherit from them
public class Animal {...
public class Dog extends Animal{...



  • Encapsulation is the technique of making the fields in a class private and providing…

View original post 401 more words

ضع تعليقك هنا

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s

%d bloggers like this: