public class Circle{
void printArea(double r){
System.out.println(r*r*3.1416926);
}
}
public class Rectangle{
void printArea(double a,double b){
System.out.println(a*b);
}
}
public class MainClass{
public static void main(String args[]){
Circle circle = new Circle();
circle.printArea(100);
Rectangle rect = new Rectangle();
rect.printArea(100,65);
}
}
------解决方案--------------------------------------------------------
如果是在一个Java文件里面只能有一个Public类或接口。
所以把前面两个类的Public去掉或改为private