GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Placement Papers  >  Satyam  >  Java
Go To First  |  Previous Question  |  Next Question 
 Java  |  Question 28 of 46    Print  
What are OOPS concepts? Explain with examples?

  
Total Answers and Comments: 4 Last Update: October 23, 2007   
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: ravi
 

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.



Above answer was rated as good by the following members:
Shinytech
March 07, 2006 03:31:57   #1  
joy        

RE: What are OOPS concepts? Explain with examples?

The basic features of oop's concept are Polymorphism Data Encapsulation Data Abstraction Inheritence.

Polymorphism different forms of same object.
Data Encapsulationeg: private protected are used bf4 declaring the variable within a class to prevent the access of those variables from other class.
Data Abstraction
Inheritence


 
Is this answer useful? Yes | No
January 03, 2007 04:58:37   #2  
ravi        

RE: What are OOPS concepts? Explain with examples?

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.


 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
January 06, 2007 02:53:46   #3  
vmshenoy Member Since: October 2005   Contribution: 508    

RE: What are OOPS concepts? Explain with examples?
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

 
Is this answer useful? Yes | No
October 22, 2007 02:06:01   #4  
Padma        

RE: What are OOPS concepts? Explain with examples?
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 useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape