What is the default package in which my classes are put if I don't specify it?

后端 未结 3 498
误落风尘
误落风尘 2020-11-27 20:46

Let\'s assume I have a file named Main.java with the following code:

public class Main {
    public static void main(String[] args) {
        System.out.prin         


        
3条回答
  •  眼角桃花
    2020-11-27 21:23

    According to the JLS it's called:

    7.4.2 Unnamed Packages

    A compilation unit that has no package declaration is part of an unnamed package.

提交回复
热议问题