java小问题,怎样修改

[复制链接]
查看11 | 回复4 | 2010-4-2 17:02:42 | 显示全部楼层 |阅读模式
你提问好歹你也把问题列出来,当回答的都是神仙啊
回复

使用道具 举报

千问 | 2010-4-2 17:02:42 | 显示全部楼层
你看你就是SB一个
回复

使用道具 举报

千问 | 2010-4-2 17:02:42 | 显示全部楼层
空指针异常 a 没有初始化循环体内第一行 a = new Student();
回复

使用道具 举报

千问 | 2010-4-2 17:02:42 | 显示全部楼层
>> public static void main(String args[]) throws java.io.IOException {Student a[] = new Student[5];int i;for (i = 0; i < 5; i++) { a=new Student();
//<---加入此句 System.out.println("Student" + i); System.out.println("Student Id="); a.getStudentId(); System.out.println("Student ClassId="); a.getClassId(); System.out.println("Student Name="); a.getStudentName(); System.out.println("Student Sex="); a.getStudentSex(); System.out.println("Student Age="); a.getStudentAge();}<<main方法中, a=new Student();
//<---加入此句此处加上这句话.需要在此为a申明个实例.
回复

使用道具 举报

千问 | 2010-4-2 17:02:42 | 显示全部楼层
最起码把错误列出来吧....
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行