package cn.gdsdxy;
import java.util.Scanner;
public class MainClass {
public static void main(String[] args) {
SquareClass obj1 = new SquareClass();
Scanner in = new Scanner(System.in);
int len = in.nextInt();
obj1.setLength(len);
System.out.println(obj1.getArea());
SquareClass obj2 = new SquareClass(10d);
System.out.println(obj2.getArea());
double length = in.nextDouble();
SquareClass obj3 = new SquareClass(length);
System.out.println(obj3.getArea());
}
static class SquareClass {
double length;
double getArea() {
double area = length * length;
return area;
}
public SquareClass(double len) {
this.length = len;
}
SquareClass() {
}
public double getLength() {
return length;
}
public void setLength(double length) {
this.length = length;
}
}
}
学识不够,SOrry不知道什么问题
楼下哪位正解,答案基本正确