下面的程序怎么会错呢???
实在找不到错误的所在了,所以要大家帮帮看看?class parent
{
protected static int count=0 ;
public parent()
{count ++ ;}
}public class child extends parent
{
public child()
{count ++ ;}
public static void main(String args[])
{
child x = new child() ;
System.out.println("count=" + x.count) ;
}
}错误提示;
D:\JDK1.41\JDK1.41setup\bin>javac F4_7.java
F4_7.java:8: class child is public, should be declared in a file named child.javapublic class child extends parent
^
1 errorD:\JDK1.41\JDK1.41setup\bin>
实在找不到错误的所在了,所以要大家帮帮看看?class parent
{
protected static int count=0 ;
public parent()
{count ++ ;}
}public class child extends parent
{
public child()
{count ++ ;}
public static void main(String args[])
{
child x = new child() ;
System.out.println("count=" + x.count) ;
}
}错误提示;
D:\JDK1.41\JDK1.41setup\bin>javac F4_7.java
F4_7.java:8: class child is public, should be declared in a file named child.javapublic class child extends parent
^
1 errorD:\JDK1.41\JDK1.41setup\bin>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货