m文件夹下有helloworld.java:

 

package m;

import testpak.*;


public class helloworld{

    
public static void main(String [] args) {
        Test t
=new Test();
        t.a();
    }

}

 

 

内部引用了testpak文件夹下的Test.java:

 

package testpak;

public class Test{
    
public void a(){
        System.out.println(
"编译多个文件成功!");
}
}

 

其中m和package文件夹在同一目录下,编译:

C:\java_test>javac m\*.java

或者:

C:\java_test\m>javac *.java

 

运行:

C:\java_test\m>java m.helloworld

或者:

C:\java_test>java m.helloworld

 

相关文章:

  • 2022-01-09
  • 2021-09-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-02
猜你喜欢
  • 2021-12-05
  • 2021-07-01
  • 2022-12-23
  • 2021-11-28
  • 2022-12-23
  • 2022-12-23
  • 2021-08-30
相关资源
相似解决方案