继承+静态方法使用(java)

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,开发语言,spring)