ALLInterview.com :: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Google
   
 
Categories >> Software >> Java Related >> Java J2EE >> Core Java
 
 


 

 
 Core Java interview questions  Core Java Interview Questions (1722)
 Advanced Java interview questions  Advanced Java Interview Questions (331)
 Swing interview questions  Swing Interview Questions (44)
 EJB interview questions  EJB Interview Questions (134)
 Servlets interview questions  Servlets Interview Questions (255)
 Struts interview questions  Struts Interview Questions (196)
 JDBC interview questions  JDBC Interview Questions (187)
 JMS interview questions  JMS Interview Questions (9)
 SunOne interview questions  SunOne Interview Questions (3)
 J2EE interview questions  J2EE Interview Questions (71)
 Weblogic interview questions  Weblogic Interview Questions (147)
 Websphere interview questions  Websphere Interview Questions (14)
 Java Networking interview questions  Java Networking Interview Questions (20)
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions (87)
Question
explain oops concepts with examples?
 Question Submitted By :: Core-Java
I also faced this Question!!     Answer Posted By  
 
Answer
# 1
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 ?    399 Yes 57 No
Arun From India In Madurai
 
Answer
# 2
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 ?    353 Yes 99 No
Dara
 
 
 
Answer
# 3
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 ?    248 Yes 113 No
K.rajasekhar Naidu
 
Answer
# 4
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 ?    178 Yes 75 No
Srinivas
 
Answer
# 5
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 ?    94 Yes 8 No
Vijay
 
Answer
# 6
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 ?    113 Yes 43 No
Reddy
 
Answer
# 7
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 ?    97 Yes 30 No
Vikram Chandra
 
Answer
# 8
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 ?    93 Yes 35 No
Nagesh
 
Answer
# 9
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 ?    77 Yes 36 No
J
 
Answer
# 10
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 ?    74 Yes 34 No
Srinu
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
What is the difference between pageContext and page implicit objects in jsp? Merrill-Lynch 7
what is platform native code i3-Solutions 2
What are teh sub-classes of a component class?   2
What is Overriding and how can it be used? Wipro 7
What are the two ways you can synchronize a block of code? Ericsson 5
Is Cegonsoft Pvt.Ltd. a good Institute?   4
how can u apply shallow cloning and deep cloning to create object? Yash-Technologies 1
What is compile time polymorphism? Elementus-Technologies 20
can u give one sinario when you use Abstract Class and When you use Interface. ITC-Infotech 5
What Is Pointer?   4
What is run-time class and system class? what is their purpose?   1
"we cannot create an object of interface but we can create a variable of it".diacuss the statement with the help of an example.   2
 
For more Core Java Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
   
Copyright 2013  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  KalAajKal.com