How do I run a Java class in a package?

后端 未结 5 1777
眼角桃花
眼角桃花 2020-11-28 11:37

I have two java classes as follows

App1 without a package:

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


        
5条回答
  •  清酒与你
    2020-11-28 11:57

    App2 needs to be in the java/java/package1 directory. In java, the package name and the directory for the source code must match. Did you not get a compilation error?

提交回复
热议问题