程序功能如下:有一个主方法main() 以及一个求平方和的方法int square(int x, int y)。square方法计算参数x 和y的平方和,并返回该平方和值。在主方法main中定义两个整型变量,并给它们赋一个初值,然后使用这两个变量作为实际参数来调用square方法,求出平方和,最后输出平方和。
public class abc {
int square(int x,int y){
return (x*x+y*y);
}
public static void main(String args[]){
abc a;
a=new abc();
System.out.println("x*x+y*y"+a.square(3, 4));
}