The root concept of the object oriented programming(OOP) is 'Object' and developing programs using class and object. OOP languages allow programmers to use and reuse the same modules multiple times.You yourself are an 'object'. Tell me about yourself,(properties) - name - yoyo, age- 28.What can you do(methods) eating-eat(), running - run()
In JAVA there is a main task to perform(Main method). That one task is divided into many modules(classes). Each class can perform certain task. Many methods are written inside a class to perform actions with data(variable). So variables and methods are also called 'members' of the class.
Some features of OOP are
An access specifier is a key word that specifies how to access the member of classes or a class itself. There are four access specifiers in Java:
Private: 'Private' members of a class are not accessible anywhere outside the class. They are accessible only within the class by the methods of that class.
Public: Public member of a class are accessible from everywhere.
Protected: Accessible outside the class but only within the same directory.
Default: If not specified by a programmer, it is 'default' . Default members are accessible outside the class, bur within the same directory.Private for instance variable. Public for methods, class.