public class Application {
public static void main(String[] args) {
A a =new A(2,8.0);
System.out.println(a.i+","+a.x);
b(a);
System.out.println(a.i+","+a.x);
}
public static A b(A a){//类方法(静态方法)
a.i++;
a.x+=2;
return a;
}
}
class A{
int i;
double x;
public A(int i,double x){
this.i=i;
this.x=x;
}
}
继承+静态方法使用(java)
最新推荐文章于 2024-08-24 17:09:16 发布