写入HlloWorld时出错:HlloWorld.class拒绝访问
很高兴得到你的采纳!!!
没写public吧public class HelloWorld{...
这样的
你的文件名应该和你定义的类名一致
程序没问题,不写public也能正常编译。
提示拒绝访问的话是可能你这个文件夹没有写的权限,
把HelloWorld.java换个地方编译试一下,比如c:/temp目录,或者桌面。
把这个代码运行编译试试,应该是你写的不规范,编译通过了,但是运行有问题
public class est {
public static void main(String[] args) {
int width = 20; // width of cube in cms
double length = 30.5; // length of cube in cms
double depth = 10.5; // depth of cube in cms
// compute the volume
double volume = width*length*depth;
// write the result
System.out.print("Your box has a volume of ");
System.out.print(volume);
System.out.println(" cubic centimetres.");
}
}
是没有配置jdk吗