Search code examples
classcustom-data-type

Default Data type in Java


Assume that I have a class called Test

public class Test{
     int a;
     public String b;
     protected int c;
     private int d;}

In this case, what is the default data type of int a(private or public)?


Solution

  • See https://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html.

    It's package protected or package private, I don't know whats the correct terminus.