Access specifiers

Java have four access specifiers.
  • public :
    • The keyword which is used a access specifier whose data can be accessible in same class, other class, other program, other folder, other colon and even other machine.
    • Java follows client-server architecture, so main() method should be public.
  • private :
    • The stronger access specified which restricts the data to be come out of class.
    • Private data can not be accessible even through it's class object.
  • protected :
    • The partial public and partial private access specifier.
    • It follows public property as the data can be come out of the class but only in inheritance.
    • It private property can not be accessible through class object.
  • default :
    • It is not keyword.
    • It works same as public up-to one working folder.
    • Otherwise it becomes private.


Static

Static keyword is used to load the main method into primary memory by JVM[Java Virtual Machine].

void

This keyword is used as a return type of method is not going on return any value.

main

A flag which is used as indicator of starting point of program for compiler and inter-printer.
Axact

Narendra

Hello, everyone! I am Narendra Bagul founder of Javanotes9. First of all thank you for visiting my blog. Hope you all like my java notes as well. I'm young part time blogger and a Computer Engineering student. I started blogging as a hobby. Now here I'm sharing my little acquired knowledge about my favorite programming language JAVA.

Post A Comment: