A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© lyoivneg 中级黑马   /  2016-3-27 20:24  /  943 人查看  /  13 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

student  s=new student[5];  这句话有错吗   如果有 错在哪里

13 个回复

倒序浏览
把 [5改成()就对了]
回复 使用道具 举报
是想要student的数组吗?student [] s=new student[5];
还有类的首字母最好大写
回复 使用道具 举报
Student[] s = new Student[5];
回复 使用道具 举报
s大写            
回复 使用道具 举报
要不是Student[] s=new Student[5];要不是Student s=new Student();两边类型不匹配.
回复 使用道具 举报
Student s = new Student();  //这是对Student创建对象
Student[] s = new Student[5];   
回复 使用道具 举报
Student s = new Student();  //是创建对象
Student[] s = new Student[5];//是创建数组
回复 使用道具 举报
不明白student是什么,是想要新建一个类的对象还是建一个数组
回复 使用道具 举报

Student s = new Student(); 是创建对象
Student[] s = new Student[5];是创建一个引用类型的数组

看你要什么
回复 使用道具 举报
上面解释的已经很详细了
回复 使用道具 举报
有错啊,student []  s=new student[5]; 格式问题
回复 使用道具 举报
[5]改成(5) 创建对象
回复 使用道具 举报
类型不匹配   你再看看数组是怎么创建的
还有类对象是怎么创建的
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马