class A
{
String name;
int age;
A(String name,int age)
{
this.name = name;
this.age = age;
}
void show()
{
System.out.println("name:" + name + "\tage:" + age + "\n");
}
}
class ObjeceArray
{
public static void main(String[] args)
{
A a1 = new A("zhangsan",31);
A a2 = new A("qingxia",13);
A a3 = new A("qwe",15);
A[] a = new A[]{a1,a2,a3};
for(int i = 0;i<a.length;i++)
{
a[i].show();
}
}
}
|
|