-2

what is the default package and default class in java?

i checked on the internet but couldn't find a concrete answer. So please reply for my question.

Roman C
  • 49,761
  • 33
  • 66
  • 176

2 Answers2

7

There's no such thing as "default class". "Default package" is another word for the "unnamed package" described in the Java Language Specification section 7.4.2

Dawood ibn Kareem
  • 77,785
  • 15
  • 98
  • 110
0

If you don’t explicitly package your classes or interfaces, In that case, they’re packaged in a default, no-name package. This default package is automatically imported in the Java classes and interfaces defined within the same directory on your system.
A class from a default package can’t be used in any named packaged class, regardless of whether they are defined within the same directory or not.

sha mohd
  • 71
  • 1
  • 4