-1

Why there is a Java class declaration without public or private at the beginning?

For example :

class MyClass{
  // code 
}
Fallen
  • 4,435
  • 2
  • 26
  • 46
  • because it is default... means a class declaration without public or private is always private. – nano_nano Aug 15 '14 at 11:39
  • @StefanBeike Actually, in Java, the lack of modifier is not equivalent to private as indicated in http://stackoverflow.com/questions/215497 – David Segonds Aug 15 '14 at 12:10

1 Answers1

3

It is called default access modifier or package private modifier. It means that class is accessible only within the package it is in.

Heisenberg
  • 3,153
  • 3
  • 27
  • 55