向方法传递多个参数

/*向方法传递多个参数
 * 要以正确的数量,顺序,类型加以传递*/
public class Xiangfangfachuanduocanshu {
    public static void main(String[] args){
        Xiangfangfachuanduocanshu s = new Xiangfangfachuanduocanshu();
        s.go();
    }
   void takeTwo(int x,int y){
       int z=x+y;
       System.out.println("Total is "+z);
   }
   void go(){
       int m = 12;
       int n = 34;
       takeTwo(m,n); 
   }
}

posted @ 2016-08-13 16:06  特雷恩  阅读(126)  评论(0编辑  收藏  举报