import java.lang.*;
public class Si
{
int width;
int length;
int zhouchang;
public void culzhouchang(){
zhouchang = width * length;
System.out.println(zhouchang);
}
}
public class Changfang extends Si
{
int square;
public void zheng(){
square = width * length;
System.out.println(square);
}
public void chang(){
square = width * length;
System.out.println(square);
}
public static void main(String args[]){
Changfang a = new Changfang();
a.width = 10;
a.length = 2;
a.culzhouchang();
a.zheng();
a.chang();
}
}
同一个java文件里只能有一个public类,且该public类与文件名相同。
你这写了2个puiblic类 当然报错了
改成
import java.lang.*;