What are OOPS concepts? Explain with examples?

Showing Answers 1 - 10 of 10 Answers

joy

  • 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

  Was this answer useful?  Yes

ravi

  • 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=forms

5) 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.

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

 Encapsulation
It 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

  Was this answer useful?  Yes

Padma

  • Oct 22nd, 2007
 

There are three types of oops in java.
1.Encapsulation:Encapsulation is mechanism, that binds
together data and code its manipulates.
Ex:suppose we are writing one bean. we declaring two private
variables. we are providing setters and getters methods of
two variables. These variables are accessed in that class.
2.Inheritance:To acquire the base class properties into
derived 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 of
actions.
There are two types of polymorphisms.
1.Compile-time polymorphism:what object will be assigned to
the 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 the
present variable. This will be evaluated at runtime depending
on condition. This is known as Run-time polymorphism.

Altumish

  • May 6th, 2012
 

Object
Class
Data Encapsulation
data Abstraction
Inheritance
Polymorphism
Message Passing
Dynamic Binding

  Was this answer useful?  Yes

subbu

  • May 30th, 2012
 

I want oops concepts with coding.

  Was this answer useful?  Yes

bayisa

  • Jun 5th, 2012
 

Encapsulation
Inheritance
Polymorphism

  Was this answer useful?  Yes

Logarasu

  • 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

  Was this answer useful?  Yes

Boney

  • Apr 19th, 2014
 

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

  Was this answer useful?  Yes

Give your answer:

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

Answer Question

Click here to Login / Register your free account


 
Send   Reset

 

Related Answered Questions

 

Related Open Questions