Search code examples
javamodifier

What happens if a modifier is not specified in java?


 class BTNode
 {    
     BTNode left, right;
     int data;

     //constructors and methods
} 

In this piece of code no specific modifier is used. What happens then in context of modifier? are their any default behavior?


Solution

  • From the Java docs:

    If a class has no modifier (the default, also known as package-private), it is visible only within its own package (packages are named groups of related classes)

    You can read about it here