123ArticleOnline Logo
Welcome to 123ArticleOnline.com!
ALL >> Computer-Programming >> View Article

Oops Concept Forms The Basis Of Java Programming Language

By Author: There are huge number of institutes for Java in B
Total Articles: 396

There are mainly six OOPs concepts in general.
• Object
• Class
• Inheritance
• Polymorphism
• Abstraction
• Encapsulation

What is an object? Let me explain you this with a very simple example.
Consider a phone, now remember that an object always consists of behavior and state. In our current example a mobile can have behaviors i.e. It can make & receive calls, It can receive messages , It can set alarms etc. while it can have states too i.e. it will have model number, color, type etc. Best core java training in Bangalore

So guys always remember that an object always consists of state and behavior.

Class is a logical collection of the objects and nothing more than that.
Moving on with our current example if an object is a phone than the collections of different types of phones is known as a class or if you consider vehicle as a class then collection of all types of vehicle i.e. car, bike, truck, ambulance, scooter etc. can considered as objects of this class. Similarly think of other examples of your own.
Inheritance is a special type of relationship where a class acquires the inherent properties of its parent class along with this it also contains its own exclusive properties.

For eg. Consider there is a Phone class which is a parent class ,now phone class can contain very basic properties that a other types of phone class should possess i.e. make and receive calls and redial properties. As shown in the above diagram there are three child classes of the phone class
Telephone contains the properties of parent class and it does not have it own properties
Mobile phone inherits the properties of parent class as well as its own exclusive properties like send and receive messages.
Smart phone inherits the properties of parent class along with this it also contains its own properties like send and receive messages , browse internet and install and use applications which is made specially for smartphones. Java Training in Bangalore


Polymorphism simply means having multiple forms. Let me explain you this with an example and how this concept fits into java.
Consider a real world scenario , in cricket we know that there are different types of bowlers i.e. Fast bowlers , Medium pace bowlers and spinners as shown in the above figure. As you can see in the diagram that there is a parent class called BowlerClass and it has three child classes called FastPacer, MediumPacer and Spinner classes. Bowler class has bowlingMethod() and all the child classes inheriting this bowlingMethod(). As we all know that a fast bowler will going to bowl differently as compared to medium pacer and spinner in terms of bowling speed, long run up and way of bowling,etc. Similarly a medium pacer’s implementation of bowlingMethod() is also going to be different as compared to other bowlers. And same happens with spinner class.
The point of above discussion is simply that a same name tends to multiple forms.All the three classes above inherited the bowlingMethod() but their implementation is totally different from one another.
Polymorphism in JAVA is implemented by two ways:
1. Method Overriding
2. Method Overloading
Above example was of method overriding.
Abstraction means hiding the complexity and showing the easier form of the system .

For eg. Consider a bike as shown in the above figure, we all know that bike consists of various sophisticated parts like ignition system, exhaust pipe, wheels, brake systems etc. as shown in the above figure.
As a bike rider,we are not aware of the internal complexity and internal functionality of various parts of our system(bike) or in other words this complexity and internal functionality is hidden from us because as a bike rider we do not bother about how this complicated parts are implemented with each other. As a rider we only need to start our ignition system and change the gear to ride the bike.
This is called abstraction where easier form of the system is exposed to you without exposing the complexities. Similarly you can point out as many examples of abstraction from your surroundings like telephone, television, vehicles, computers ,etc.
In java abstraction is implemented using two ways
1. Interface
2. Abstract Class
Encapsulation means data hiding in-order to make it safe from any modification. What does it mean? The best example to understand encapsulation is a Medical capsule. Drug is always safe inside the capsule. Encapsulation is implemented using POJO classes (getter and setter methods).

More About the Author

We offer innovative and customized Java Training in Bangalore. Best Java course in Bangalore with Certified Experts. Go to free demo classes, get prepared by 8yrs experienced tutors and furthermore get hands on live project. Visit: http://infocampus.co.in/java-training-bangalore.html

Total Views: 68Word Count: 715See All articles From Author

Computer Programming Articles

1. Test Automation – Importance Of Selenium Ide With Features
Author: Siyaram ray

2. The Effect Of Chicken Cage On Temperature Regulation Of Chicken House
Author: The effect of chicken cage on temperature regulati

3. The Chicken House Needs Ventilation
Author: The chicken house needs ventilation

4. Automation Testing - Instructions For Integrating Jenkins With Selenium Webdriver
Author: Siyaram ray

5. 10 Performance Enhancement Tips For Mobile App Development
Author: august sin

6. E-commerce Software Provider Company In India For Best E-commerce Solutions
Author: Zentryx Tech

7. Automation Testing - Selenium Webdriver Testing Tool
Author: Siyaram ray

8. Career Opportunities As A Selenium Tester
Author: Siyaram ray

9. How To Do A Good Job In Heatstroke Prevention In Chicken Farms
Author: How to do a good job in heatstroke prevention in c

10. Selenium Testing Tool Is More Used In Automation Testing
Author: Siyaram ray

11. Simplify For Better Sales: Tips For Optimizing The Checkout Page
Author: Shailesh Gajjar

12. Did Web Development Training Is Require
Author: Siyaram ray

13. Join Selenium Training In Bangalore To Become Selenium Master
Author: Siyaram ray

14. Direct Mail Marketing Services – Why It Is An Integral Part Of Your Advertising Campaign
Author: Daniel Mena

15. Building Advance Website On Drupal Cms – A Scalable Option For Your Business
Author: Zentryx Tech

Login To Account
Login Email:
Forgot Password?
New User?
Sign Up Newsletter
Email Address: