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
   
 


 

Company >> robert bosch >> Technical Test Questions
 
  Mechanical Engineering Technical Test Questions (1)   Core Java Technical Test Questions (1)
 
Back to Questions Page
Question   what are the oops concept in java explain with real time examples Rank Answer Posted By  
 Interview Question Submitted By :: Jawahar
I also faced this Question!!   ALL Interview .com
Answer
Encapsulation

Abstraction

polymorphisms

inheritance/delegation
 
3 Raja
 
 
Answer
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 butttons,we don't see the
button circuits.i.e buttons circutes 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

Polymorphisam:

          Sinle Form behaving diffreantly in diffreant
Situations.
  Example:-
            Person
Person in Home act is husband/son,
       in Office acts Employer.
       in Public Good Cityzen. 

I think these all are real time experianceany.is there any 
more answers send me my mail also.

Thanks all
CM
 
4 Chandramouli
 
 
Answer
1)Abstraction: 

Abstraction is a way to remove the association of the
behavior of an object with the actual details behind the
scenes which implement that object's behavior. This
'abstraction' is usually accomplished through the use of
base classes with virtual functions; each derived function
provides the details that implement the behavior behind that
abstraction.

eg/we invented flight based on the mechanism of Birds. So
flight is derived form the base of birds.

2)Encapsulation: 

It is a process of binding or wrapping the data and the
codes that operates on the data into a single entity. This
keeps the data safe from outside interface and misuse. One
way to think about encapsulation is as a protective wrapper
that prevents code and data from being arbitrarily accessed
by other code defined outside the wrapper.

eg/ Ink is the important component in pen but it is hiding
by some other material

3)Polymorphism: 

a single function or single operator has different character
in different place.

eg/A girl plays a role of daughter at home and a manager at
office

4)Inheritance:

 The new classes, known as derived classes, take over (or
inherit) attribute and behavior of the pre-existing classes,
which are referred to as base classes (or Parent classes).
It is intended to help reuse existing code with little or no
modification.

eg/ parent-child relation
 
2 Ramya
 
 
 
Answer
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 butttons,we don't see the
button circuits.i.e buttons circutes 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

Polymorphisam:

          Sinle Form behaving diffreantly in diffreant
Situations.
  Example:-
            Person
Person in Home act is husband/son,
       in Office acts Employer.
       in Public Good Cityzen. 

I think these all are real time experianceany.is there any 
more answers send me my mail  mdevendra@gmail.com also.

Thanks all
Devendra.M
 
2 Devendra.m
 
 
Answer
OOPS Concepts are mainly 4 
 1.Abstraction
 2.Encapsulation
 3.Inheritance 
 4.Polymorphisam

Abstraction:Hiding unneccessary data from user is called 
Abstraction access specifiers like public,private etc are 
used to provide different level in abstraction.


Encapsulation:Taking data and object in a single unity is 
called Encapsulation.A class is example for Encapsulation.

Inheritance:creating anew class from existing class is 
called Inheritance.reusability is main advantage in 
inheritance.

polymorphism:if single mthod performs different task is 
called polymorphism.
 
5 Praveena
 
 
Answer
1,class
2,encapsulation
3,polymorphism
4,inheritance
5,Abstraction
 
class
         collection of attributes is called class
Real time example......human body

encapsulation
        To encapsulate the some methods,operations in one
class is called the encapsulation
Real time example...... capsules

polymorphism
        To ability to take more than one form
Real time example...... xerox machine
inheritance
        one class properties occur from another class properties
Real time example......land line...will phone....cellphone
2g....3g....
 
5 Niventh Mca
 
 
Answer
encapsulation
abstraction
interface
polymorphism
imheritance
 
5 Atif Hossain
 
 
Answer
oops concepts are mainly 3
1.encapsulation
2.inheritance
3.polymorphism

 1 :- encapsulation refers to binding the data in a single
class the data present inside the encapsulation is secured.

abstraction comes under encapsulaton.

real time example:-if you get fever you will take the
medicine to cure.the medicine is the capsule in which the
powder is present.the powder is a mixture of several
chemicals as in the same way all the classes are mixed and
only the output(object) you will see as if a capsule.

 2 :- inheritance is nothing but extending the class from
parent to the child 

real time example:- the prime minister of india
(late)mr.jawaharlal nehru and his daughter indira gandhi
and her son rajiv gandhi and his wife sonia gandhi.

 3 :- polymorphism refers to which it does many things 

real time example:- consider the electric power which does
many things .
 
0 Suresh
 
 
Answer
We have the following oops concepts like 
1.Abtsrction
2.Encapsulation
3.Inheritance
4.Polymorphism

Abstraction:

hiding unnecessary data from the users and making the
application as user friendly then it is called as abstrcation

ex:Any mail account the user is simply filling the form and
he don't know ho it is developed.

Encapsulation:

Wrapping the data and code as a single unit is called as
encapsulation.

ex:Capsule is the best real time example for it.In it we
will have two types of drugs combined as single capsule.

Inheritance :
Acquiring the properties from one class(base class or parent
class)to another class(derived class or child class)is
called as inheritance.

Ex:Inventing laptop from desktop.

Polymorphism:

Single entity behaving in different forms  is called as
polymorphism

ex:Mouse is for click the buttons and  dragging the  bars or
placing the pointer in a particular place.
 
5 Murali Krishna Thanneeru
 
 
Answer
We have the following oops concepts like 
1.Abtsrction
2.Encapsulation
3.Inheritance
4.Polymorphism

Abstraction:

hiding unnecessary data from the users and making the
application as user friendly then it is called as 
abstrcation

ex:Any mail account the user is simply filling the form and
he don't know ho it is developed.

Encapsulation:

Wrapping the data and code as a single unit is called as
encapsulation.

ex:Capsule is the best real time example for it.In it we
will have two types of drugs combined as single capsule.

Inheritance :
Acquiring the properties from one class(base class or parent
class)to another class(derived class or child class)is
called as inheritance.

Ex:Inventing laptop from desktop.

Polymorphism:

Single entity behaving in different forms  is called as
polymorphism

ex:Mouse is for click the buttons and  dragging the  bars or
placing the pointer in a particular place.
 
5 L.priya
 
 
Answer
Abstraction:
   Hiding unnecessary things and showing the essential 
information.

Example: Suppose take a car: In that we will have breaks 
and stering and etc... Here when we are changing the gear 
box to up or bottom then gears will work but we don't know 
how they are managing internally and we don't no how it is 
working. As a driver we don't need to know how it is 
working internally when we are changing every time. That is 
the reason they will hide the wires and cables internally 
and they will show up only gear box to us.

Advantages: 1) Code will be clean and for managing it will 
be very easy

Inheritance:

       Acquiring the properties from super class to 
subclass.

Example: Suppose take two java classes
Class A contains 2 variables and ClassB Extends Class A 
that means here ClassB can access the classA variables 
without declaring it. If we do this then the memory will be 
less and reusable.

Advantages: 1)Reusability of code

Encapsulation: Wrapping up of data and methods into a 
single unit.

Example: In our class we need to make all our varables and 
methods keeping together.

Advantage: Maintance will be good

Polymorphism: It means many forms.
2 types:
1) Compile time polymorphism
2) Run time polymorphism

Method overloading is an example for Compile time 
polymorphism and
Method overriding is an example for Run time polymorphism
 
0 Bhaskara Reddy Akepati
 
 
Answer
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:Any electronic Device

in that we don't see the
button circuits.i.e buttons circutes 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:A state Or Country
i.e different culture districts make a state.and different behaviours of states form a country..
I think it is good example

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

Real Time Example:

      Father and Son Relationship is the Ever green example 

Polymorphisam:

          Sinle Form behaving diffreantly in diffreant
Situations.
  Example:-
            Camera Mobile
when we talk used as communicator,
  When we go for a tour used as a camera.
  When we want to enjoy used as a player or FM. 

I think these all are real time experianceany.is there any 
more answers send me my mail  Madhu.jjj@rediffmail.com also.
 
0 Madhu
 
 
Answer
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:Any electronic Device

in that we don't see the
button circuits.i.e buttons circutes 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:A state Or Country
i.e different culture districts make a state.and different 
behaviours of states form a country..
I think it is good example

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

Real Time Example:

      Father and Son Relationship is the Ever green example 

Polymorphisam:

          Sinle Form behaving diffreantly in diffreant
Situations.
  Example:-
            Camera Mobile
when we talk used as communicator,
  When we go for a tour used as a camera.
  When we want to enjoy used as a player or FM. 

I think these all are real time experianceany.is there any 
more answers send me my mail  Madhu.jjj@rediffmail.com also.
 
0 Ajay Kumar Agarwal
 
 
Answer
The OOPs concepts are:-
Object:-An object can be considered a "thing" that can 
perform a set of related activities. The set of activities 
that the object performs defines the object's behavior. For 
example, the hand can grip something or a Student (object) 
can give the name or address. 

Class:- A class is simply a representation of a type of 
object. It is the blueprint/ plan/ template that describe 
the details of an object. A class is the blueprint from 
which the individual objects are created. Class is composed 
of three things: a name, attributes, and operations. 

public class Student
{
}
According to the sample given below we can say that the 
student object, named objectStudent, has created out of the 
Student class. 

Student objectStudent = new Student();

Encapsulation or information hiding:-The encapsulation is 
the inclusion within a program object of all the resources 
need for the object to function - basically, the methods 
and the data. In OOP the encapsulation is mainly achieved 
by creating classes, the classes expose public methods and 
properties. The class is kind of a container or capsule or 
a cell, which encapsulate the set of methods, attribute and 
properties to provide its indented functionalities to other 
classes. In that sense, encapsulation also allows a class 
to change its internal implementation without hurting the 
overall functioning of the system. That idea of 
encapsulation is to hide how a class does it but to allow 
requesting what to do. 

There are several other ways that an encapsulation can be 
used, as an example we can take the usage of an interface. 
The interface can be used to hide the information of an 
implemented class. 

IStudent myStudent = new LocalStudent();
IStudent myStudent = new ForeignStudent();

Abstraction and Generalization:-Abstraction is an emphasis 
on the idea, qualities and properties rather than the 
particulars (a suppression of detail). The importance of 
abstraction is derived from its ability to hide irrelevant 
details and from the use of names to reference objects. 
Abstraction is essential in the construction of programs. 
It places the emphasis on what an object is or does rather 
than how it is represented or how it works. Thus, it is the 
primary means of managing complexity in large programs. 
Abstraction and generalization are often used together. 
Abstracts are generalized through parameterization to 
provide greater utility. In parameterization, one or more 
parts of an entity are replaced with a name which is new to 
the entity. The name is used as a parameter. When the 
parameterized abstract is invoked, it is invoked with a 
binding of the parameter to an argument. 
Abstract classes, which declared with the abstract keyword, 
cannot be instantiated. It can only be used as a super-
class for other classes that extend the abstract class. 
Abstract class is the concept and implementation gets 
completed when it is being realized by a subclass. In 
addition to this a class can inherit only from one abstract 
class (but a class may implement many interfaces) and must 
override all its abstract methods/ properties and may 
override virtual methods/ properties. 

 Inheritance:-Ability of a new class to be created, from an 
existing class by extending it, is called inheritance. 

public class Exception
{
}

public class IOException extends Exception
{
}

Polymorphism:-Polymorphisms is a generic term that 
means 'many shapes'. More precisely Polymorphisms means the 
ability to request that the same operations be performed by 
a wide range of different types of things. 

The method overloading is the ability to define several 
methods all with the same name.

public class XYZ
{
    public void Error(Exception e)
    {
        // Implementation goes here
    }

    public bool Error(Exception e, string message)
    {
        // Implementation goes here
    }
The operator overloading (less commonly known as ad-hoc 
polymorphisms) is a specific case of polymorphisms in which 
some or all of operators like +, - or == are treated as 
polymorphic functions and as such have different behaviors 
depending on the types of its arguments.
 
0 Srikanth Acharya
 
 
Answer
inheritance: deriving the properties of superclass by using 
              EXTEND method
polymorphism:poly=many form, a function with same name but 
             different parameters and type will change                        
abstraction:showing essential features by hiding non essential  
            features,by using access specifiers 
             PUBLIC,PRIVATE,PROTECTED
encapsulation: combination of data members and member 
              functions is called , data encapsulation
 
0 Venkysam
 
 
 
Back to Questions Page
 
 
 
 
 


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

ALLInterview.com   ::  KalAajKal.com