Object is an instance of a class. It is the basic run time entities in an object oriented system. Every object is associated with data and functions. Class is a group of similar objects. It can hold both data and functions. By default, all members are declared as public. Abstraction is the act of representing essential features without including background details. Classes use the concept abstraction to operate on attributes. Encapsulation allows the programmer to hide both how the state of an object is represented and how the object’s methods work. Encapsulation supports data hiding facility of objects. It is the process of using data members of a class with the same class. In no case, they can be applied to another class or the main class. Encapsulation results in modularity and information hiding. Java provides access specifiers to control the accessibility of the class elements outside its class body. Java provides following types of access specifiers – public, protected and private. Data members or member functions specified as public can be used outside a class also. Data members or member functions specified as private can be used within a class only. Protected elements are accessible only inside the same class and by the derived class. Scope rules indicates the program part in which a particular piece of code or a data value can be accessed. The various types of scope are block scope, class scope, package scope and function scope.

To Access the full content, Please Purchase