向一个方法的基本数据类型参数传值

class Tom{
void f(int x,double y){
x=x+1;
y=y+1;
System.out.printf("x y : %d,%3.2f\n",x,y);
}
}
public class Example4_7{
 public static void main(String args[]){
 int x=10;
 double y=12.58;
 Tom cat=new Tom();
 cat.f(x,y);
 System.out.printf("main x y: %d,%3.2f\n",x,y);
}
}

posted on 2013-03-24 17:23  agony·  阅读(142)  评论(0编辑  收藏  举报

导航