Posts

Showing posts with the label javaOOPS

JAVA OOPS

OOPS(Object Oriented   Programming Language) Concepts           Java is an OOPS Language. So it should satisfy all the oops concepts which we are discussing below. Encapsulation :             Encapsulation means hiding the data while accessing the object. We should not expose the data which means state   of an object This is the key rule of OOPS.       To achieve Encapsulation in JAVA we can declare any variable with access modifier private by default the access modifier is public which means any variable which have reference of an object can access the state. We have define the variables of an object like below.      class Student {         private String name;         private String rollNo;     }                      In the above object we declared 2 instance variables name and rollNo and...