正方形面积
Time Limit: 1000MS
Memory Limit: 65536KB
Problem Description
根据读入的正方形的边长(边长为正整数),输出其正方形的面积。
Input
输入数据含有多个的正方形(个数不确定)的边长a(1≤a≤10000),每个边长之间以空格隔开。
Output
每次读入一个边长,便输出其正方形的面积,每一行输出一个正方形的面积。
Example Input
1 3
Example Output
1 9
Hint
Author
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
int a = sc.nextInt();
Square square = new Square(a);
int s = square.Area();
System.out.println(s);
}
sc.close();
}
}
class Square {
int a;
public Square(int a) {
this.a = a;
}
public int Area() {
return a * a;
}
}