Series: Subject: Topic:
Question: 19 of 46

What are OOPS concepts? Explain with examples?

Asked by: Interview Candidate | Asked on: Aug 24th, 2005
Showing Answers 1 - 10 of 10 Answers

Answered On : Mar 7th, 2006

The basic features of oop's concept are Polymorphism,Data Encapsulation,Data Abstraction,Inheritance. Polymorphism different forms of same object. Data Encapsulatione.g.: private, protected are used bf4 declaring the variable within a class to prevent the access of those variables from other class. Data Abstraction Inheritance

Login to rate this answer.

Answered On : Jan 3rd, 2007

OOPS Concepts:  1) Encapsulation: Wrapping up of data and methods in to a single unit is                          called as encapsulation.  2) Abstraction: It Supports Abstarction  3) Inheritence:                   Process of Aquiring properties from one object to another                    without changes. 4) Polymorphism:                 Process of aquiring properies from one object to another                 with changes.                poly=many                morphism=forms5) Message Passing:            message passing is possible from one object to another.6) Robust and Secure:           every object is strong one.           every object is secure one with their access specifiers.

Yes  1 User has rated as useful.
Login to rate this answer.

Abstraction is an essential elementfor this, which manages the complexity. In a sense, when someone works on acomputer, not necessary that he should know the working of each and every partof the computer. Even without the hardware knowledge, he can e-mail, type or doother jobs on the computer. Thus people do not think of a computer as a unitmade up of hundreds of cards and chips, but as a well-defined object with itsown unique behavior. This is the advantage of abstraction.Object-oriented programming is modeled on how, in the real world, objects areoften made up of many kinds of smaller objects. This capability of combiningobjects, however, is only one very general aspect of object-orientedprogramming.The three OOPS concept EncapsulationIt is the mechanism that binds together code and data in manipulates, and keepsboth safe from outside interference and misuse. In short it isolates aparticular code and data from all other codes and data. A well-defined interfacecontrols the access to that particular code and data. In Java, the basis ofencapsulation is the class. A class defines the structure and behavior(data and code) that will be shared by a set of objects. Each object of a givenclass contains the structure and behavior defined by the class, as if it werestamped out of a mold in the shape of a class. A class is a logical construct,an object has physical reality. When you create a class, you will specify thecode and data that will constitute that class. Collectively, these elements arecalled the members of the class. Specifically, the data defined by theclass are referred to as member variables or instance variables.The code that operates on that data is referred to as member methods or justmethods, which define the use of the member variables.Since the purpose of a class is to encapsulate complexity, there are mechanismsfor hiding the complexity of the implementation inside the class. Each method orvariable in a class may be marked public or private. The private methods anddata can only be accessed by the code, that is a member of the class. The publicmethod has all details essential for external users.2) Inheritance:It is the process by which one object acquires the properties of anotherobject. This supports the hierarchical classification. Without the use ofhierarchies, each object would need to define all its characteristicsexplicitly. However, by use of inheritance, an object need only define thosequalities that make it unique within its class. It can inherit its generalattributes from its parent. A new sub-class inherits all of the attributes ofall of its ancestors.3) Polymorphism:It is a feature that allows one interface to be used for general class ofactions. The specific action is determined by the exact nature of the situation.In general polymorphism means "one interface, multiple methods", Thismeans that it is possible to design a generic interface to a group of relatedactivities. This helps reduce complexity by allowing the same interface to beused to specify a general class of action. It is the compiler's job to selectthe specific action (that is, method) as it applies to each situatio

Login to rate this answer.

Answered On : Oct 22nd, 2007

There are three types of oops in java.1.Encapsulation:Encapsulation is mechanism, that bindstogether data and code its manipulates.Ex:suppose we are writing one bean. we declaring two privatevariables. we are providing setters and getters methods oftwo variables. These variables are accessed in that class.2.Inheritance:To acquire the base class properties intoderived class.Ex:class A{ m1(){ System.out.println("m1 method"); }}class B extends A{ m2(){ System.out.println("m2 method"); } public static void main(String args[]){ B b = new B(); System.out.println(b.m1); System.out.println(b.m2); }}O/p is:m1 method m2 method.Polymorphism:one Interface to be used for a general class ofactions.There are two types of polymorphisms.1.Compile-time polymorphism:what object will be assigned tothe present variable. This will be evaluated at compile time.This is known as compile-time polymorphism.2.Run-time polymorphism:what object will be assigned to thepresent variable. This will be evaluated at runtime dependingon condition. This is known as Run-time polymorphism.

Yes  1 User has rated as useful.
Login to rate this answer.

Answered On : Jun 17th, 2010

View all answers by kadharjava


Login to rate this answer.

Answered On : May 6th, 2012

Data Encapsulation
data Abstraction
Message Passing
Dynamic Binding

Login to rate this answer.

Answered On : May 30th, 2012

I want oops concepts with coding.

Login to rate this answer.

Answered On : Jun 5th, 2012


Login to rate this answer.

Answered On : Jan 22nd, 2013

Encapsulation: It refers to the binding of data and functions together into a single unit

Polymorphism: POLY means many MORPHS means forms or shapes

Inheritance: The process of deriving a new class from a existing class or a base class

Abstraction: The process of exploring a data or hiding a data

Login to rate this answer.

Answered On : Apr 19th, 2014

Data Abstraction - The act of representing the essential features only without including the background details.

Login to rate this answer.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions



twitter fb Linkedin GPlus RSS


Interview Question

 Ask Interview Question?


Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.