编写Java应用程序。首先,定义描述学生的类——Student,包括学号(int)、姓名(String)、年龄(int)等属性;二个方法:Student(int stuNo,String name,int age)

用于对对象的初始化,outPut()用于输出学生信息。其次,再定义一个主类—TestClass,在主类的main方法中创建多个Student类的对象,使用这些对象来测试Student类的功能。

     //创建类
int stuNo;
String stuName;
int stuAge;
//构造方法
student(int stuNo,String name,int age)
{
this.stuNo=stuNo;
stuName=name;
stuAge=age;
}
void outPut()
{
System.out.println(stuName+"\t"+stuNo+"\t"+stuAge);
} public static void main(String[] args) {
student xs1=new student(10001,"张三",25);
student xs2=new student(10002,"李四",27);
student xs3=new student(10003,"王五",22);
student xs4=new student(10004,"马六",19);
student xs5=new student(10005,"冯七",22);
student xs6=new student(10006,"秦八",26); System.out.println("姓名:\t学号:\t年龄:");
xs1.outPut();
xs2.outPut();
xs3.outPut();
xs4.outPut();
xs5.outPut();
xs6.outPut();
}

运行结果:

最新文章

  1. 程设大作业xjb写——魔方复原
  2. Beta版本冲刺——day7
  3. dba管理
  4. 基于cocoStudio的UIListView的可以左右滑动翻页的ListView
  5. C#中结构体和类的区别
  6. 4 c#
  7. ISO14229系列之一:简介
  8. objective-c 加号 减号 - +
  9. BZOJ 1600: [Usaco2008 Oct]建造栅栏
  10. 下的生产环境was重新启动不同意,怎么做?
  11. SQLServer总结
  12. 讲述Sagit.Framework解决:双向引用导致的IOS内存泄漏(上)
  13. [SDOI2008]Sue的小球
  14. CFUpdate高速模式下出现Error #2038提示的解决方案
  15. .Net 环境下比较各种数据库插入操作的性能
  16. java抽象类和抽象方法
  17. CentOS 解决vim乱码问题
  18. 洛谷P2568 GCD(线性筛法)
  19. Spring mvc 4系列教程(二)——依赖管理(Dependency Management)和命名规范(Naming Conventions)
  20. Gerrit 使用规范

热门文章

  1. ORA-38760: This database instance failed to turn on flashback database
  2. 110_leetcode_Best Time to Buy and sell Stock II
  3. ubuntu 休眠之后蓝牙鼠标无效果。
  4. node-webkit 主页面和 iframe 页通讯
  5. 极客时间 Mysql实战45讲 07讲行锁功过:怎么减少行锁对性能的影响笔记 极客时间
  6. JQuery中的时间和动画
  7. sql 跟踪
  8. 转:IE 无法使用 js trim() 的解决方法
  9. 【原创】JMS发布者订阅者【异步接收消息】
  10. Calling convention-调用约定