import java.util.Scanner;public class test { public static void main(String[] args) { Scanner s=new Scanner(System.in); System.out.print("输入整数:"); int i=s.nextInt(); System.out.println(Math.pow(i,2)); }}你需要的是这样的吧