黑马程序员技术交流社区
标题:
eclipse的使用
[打印本页]
作者:
MAY1066
时间:
2015-7-7 23:33
标题:
eclipse的使用
package studentDemo;
public class student {
private String name;
private int age;
public student() {
super();
}
public student(String name, int age) {
super();
this.name = name;
this.age = age;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
}
//前面的是一个学生类
package studentDemo;
public class studentTest {
public static void main(String[] args) {
student s1=new student("张三",10);
student s2=new student("李四",11);
student s3=new student("王五",12);
student s4=new student("赵六",13);
student s5=new student("刘七",14);
student []stu={s1,s2,s3,s4,s5};
for (int i = 0; i < stu.length; i++) {
System.out.println(stu[i].getName()+"----"+stu[i].getAge());
}
}
}
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/)
黑马程序员IT技术论坛 X3.2