我在Visual Studio代码中创建了一个名为test的包。 用该软件包编写的程序无法执行 ,程序是:
package test;
public class Example{
public static void main(String args[])
{
System.out.println("HELLO");
}
}
It throws an error the same program works completely fine when placed in the default package here it is kindly help me with the package working or help me if there is any setting in vscode which has to be setup
问题是您不能从程序包内部运行代码。
您将必须从包的父目录运行代码
例如。如果您的文件包是这样构造的
那么您已经通过java test从SomeDirectory运行了它。