匿名对象

来源:互联网 发布:powershell管理linux 编辑:程序博客网 时间:2024/05/16 15:35
/*
匿名对象的使用
匿名对象只使用一次
结果:age = 20  tall = 1.7
*/


public class TestAno {
public static void main(String[] args) {
new Person().getInfo();
}
}


class Person {
private int mAge = 20;
private double mTall = 1.7;
public void getInfo() {
System.out.println("age = " + mAge + "  tall = " + mTall);
}
}
0 0