Sei sulla pagina 1di 2

QUES: What are OOPS concepts in java?

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

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.

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.

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