Pages

Monday, October 26, 2015

Object Oriented Programming in Java

Hi friends, really sorry for not for posting anything for long time (around 2 months). So today we gonna have simple discussion on object oriented programming principles J



          1.     Inheritance
           2.     Encapsulation
           3.     Polymorphism
           4.     Abstraction

In object oriented programming we learn that class is a blueprint that describe the behavior and the state of an object. Let’s clarify what does it mean by blueprint and how it applicable in this context.



Here the attributes of the phone shows the state of the phone & functions (in java methods) express the behavior of the phone

Here you can see the relationship between class and its objects.
·        HTC Desire 820
·        Microsoft Lumia 535
·         Galaxy S6 edge

     are objects of Phone Class.If these code segments are not clear I will post both the github repo link & slideshare link where you can download the project & the presentation.






As we discuss earlier here you can see the four main features of object oriented programming. Let’s discuss each of these feature separately with examples.

In programming we can define encapsulation is kind of blackbox .Before learning about Encapsulation it will be very useful if you can Watch this video 




Communicating with encapsulated area is only possible through messages (getter & setter methods)











Word CUT get different meanings according to the place it use.
  • For a medical surgeon “cut” leads to do an operation.
  • For an actor “cut” means to stop his /her acting 

Also same way here we can ask for a “phone“ to perform different actions