代码如下
class hello { public void string() { System.out.println("hello World!"); } } public class Hello { public static void main(String[] args) { System.out.println("Hello World!"); hello h=new hello(); h.string(); } }
编译能通过,但运行时会出现异常:
这是因为Windows 不区分文件名大小写,你把文件名搞错了,它和 public class 名字有着大小写的不同。