explain oops concepts with examples?

Answers were Sorted based on User's Feedback



explain oops concepts with examples?..

Answer / arun from india in madurai

OOP is Nothing but Object Oriented Programming.
In OOPs concept is implimented in our real life systems.
OOPs have following features
1. Object - Instance of class
2. Class - Blue print of Object
3. encapsulation - Protecting our data
4. polymorphism - Different behaviors at diff. instances
5. abstraction - Hidding our irrelavance data
6. inheritence - one property of object is aquring to
another property of object

Simple Ex.

Please assume u standing near a car. How to impliments our
OOPs concept for this scenario ?

Simple,
car is a object b'coz it having more functions.
car is a class b'coz it contain more parts and features
inside.
car is a Encapsulation B'coz it protected some unwanted
parts or functions to user
car is a Polymorphism b'coz it have different speed as
display in same speedometer
car is a Abstraction b'coz it hidding more parts by coverig
such as engine,disel tank
car is a Inheritance b'coz one car is a property of more
people. i mean your car is driving bu you, your friend and
your relatives.

Is This Answer Correct ?    438 Yes 63 No

explain oops concepts with examples?..

Answer / dara

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.

Is This Answer Correct ?    363 Yes 101 No

explain oops concepts with examples?..

Answer / k.rajasekhar naidu

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 anotherwith 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.

Is This Answer Correct ?    258 Yes 120 No

explain oops concepts with examples?..

Answer / srinivas

oops means object oriented programming. which contains only
objects&methods.java is one of the object oriented
programming language.. but it is not a 100% oop... Because
java uses premitive datatypes.....
oops contains some features:
1:encapsulation
2:inheritance
3:polymorphism

Is This Answer Correct ?    185 Yes 77 No

explain oops concepts with examples?..

Answer / vijay

OOPS Concepts are mainly 4

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

Abstraction:- Hidding non-essential features and showing the
essential features
(or)
Hidding unnecessary data from the users details, is called
abstraction.

Real Time example: TV Remote Button
in that number format and power buttons and other buttons
there just we are seeing the buttons, we don't see the
button circuits .i.e buttons circuits and wirings all are
hidden. so i think its good example.

Encapsulation:
Writing Operations and methods stored in a single
class. This is Called Encapsulation

Real Time Example: Medical Capsuals
i.e one drug is stored in buttom layer and another drug is
stored in Upper layer these two layers are combined in
single capsual.

Inheritance:
The New Class is Existing from Old Class, i.e SubClass is
Existing from Super Class.

Real Time Example:
Father and Son Relationship

Polymorphism:
Sinle Form behaving differently in different
Situations.

Example:-
Person
Person in Home act is husband/son,
in Office acts Employer.
in Public Good Citizen.

Is This Answer Correct ?    101 Yes 10 No

explain oops concepts with examples?..

Answer / reddy

Abstraction: giving only important things hiding unnecessary
things.
data hiding: we can get by using private keyword
encapsulation: abstraction+data hiding(security)
polymorphism: flexibility
inheritance: reusability

Is This Answer Correct ?    116 Yes 44 No

explain oops concepts with examples?..

Answer / vikram chandra

OOP is Nothing but Object Oriented Programming.
In OOPs concept is implimented in our real life systems.
OOPs have following features
1. Object - Instance of class
2. Class - Blue print of Object
3. encapsulation - Protecting our data
4. polymorphism - Different behaviors at diff. instances
5. abstraction - Hidding our irrelavance data
6. inheritence - one property of object is aquring to
another property of object

Simple Ex.

Please assume u standing near a car. How to impliments our
OOPs concept for this scenario ?

Simple,
car is a object b'coz it having more functions.
car is a class b'coz it contain more parts and features
inside.
car is a Encapsulation B'coz it protected some unwanted
parts or functions to user
car is a Polymorphism b'coz it have different speed as
display in same speedometer
car is a Abstraction b'coz it hidding more parts by coverig
such as engine,disel tank
car is a Inheritance b'coz one car is a property of more
people. i mean your car is driving bu you, your friend and
your relatives.

Is This Answer Correct ?    101 Yes 30 No

explain oops concepts with examples?..

Answer / nagesh

OOP is Nothing but Object Oriented Programming.
In OOPs concept is implimented in our real life systems.
OOPs have following features
1. Object - Instance of class
2. Class - Blue print of Object
3. encapsulation - Protecting our data
4. polymorphism - Different behaviors at diff. instances
5. abstraction - Hidding our irrelavance data
6. inheritence - one property of object is aquring to
another property of object
7.Message Passing:message passing is possible from one
object to another
8.Robust and Secure: every object is strong one.
every object is secure one with their access specifiers.

Is This Answer Correct ?    97 Yes 37 No

explain oops concepts with examples?..

Answer / srinu

dataabstraction:it is giving only important things hiding
unnecessary things

encapsulation : it is data hiding under wrapper class

inheritance :it is reusebility code
example : parent propert belongs to child

polymorpism: it is flexibility when output depends upon
no of input
in this we have overloading




overloading means it contains same data type and
different parameters

Is This Answer Correct ?    77 Yes 35 No

explain oops concepts with examples?..

Answer / j

Encapsulation is the procedure of covering up of data and
functions into a single unit. Encapsulation (also
information hiding) consists of separating the external
aspects of an object which are accessible to other objects,
from the internal implementation details of the object,
which are hidden from other objects.

A process, encapsulation means the act of enclosing one or
more items within a (physical or logical) container (Class)

Is This Answer Correct ?    79 Yes 38 No

Post New Answer

More Core Java Interview Questions

what really hapens when a object is created using new operator? 1.is it allocates memory to all variables and methods in the class with reference to that object?

3 Answers  


What is difference between compatible and incompatible changes in serialization?

1 Answers   Synechron,


what is meant wrapper classes?

0 Answers  


how exactly garbage collection take place?

4 Answers  


why HashTable not allow null key and value

2 Answers   Crimson Logic,






What are parsers? Dom vs sax parser.

0 Answers  


What is the abstraction?

0 Answers  


what is bmg file and how to create that files?what will it contailn?

0 Answers   HCL, Probe Services,


Can a abstract class be declared final?

0 Answers  


What modifiers are used with an inner class which is a member of an outerclass?

1 Answers  


How to sort an unsorted array in java?

0 Answers  


Can we extend private class in java?

0 Answers  


Categories