zackmathews zackmathews - 1 month ago
155 0

Here i am explaining four type access specifier in java.
Private
public
protected
default

Java

Access specifier and modifier in java

Public

class access
    {
       public String Stra;
       public void print()
        {
            System.out.println("MindStick is better than" + Stri);
        }
    }
 
    class Program
    {
        static void Main(String[] args)
        {
            access sp = new access();
            System.out.println ("Enter the name of the company :");
            sp.Stri = System.console().readLine();
            sp.print();
        }
    }
}

To know more in details check  this useful article---
https://www.mindstick.com/blog/11215/access-specifier-and-modifier-in-java
Comments