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

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© L番茄X 中级黑马   /  2015-5-31 13:38  /  692 人查看  /  14 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

class Student
{
  String name ;
   int age;
}
class Demo
{
  public static void main(String[] args)
{
    系统添了一个无参的构造方法.
       Student stu = new Student();
       stu.name = "小红";
       stu.age  = 21;
     Student stu1 = new Student();
     stu1.name = "小明";
     stu1.age = 19;
   Student stu2 = new Student();
    stu2.name = "小王";
    stu2.age = 20;
  Student[] arr = new Student[3];
    arr[0] = stu;
    arr[1] = stu1;
    arr[2] = stu2;
  for(int i = 0 ; i <arr.length ; i++){
    Student s = arr[i];
    System.out.println(s.name +"---"+s.age);
   }
}
}

14 个回复

倒序浏览
只能多敲了
回复 使用道具 举报
:L:L:L:L:L:L
回复 使用道具 举报
拉出去斩了 -      -- - - - -
回复 使用道具 举报
敲十遍肯定能记住,哈哈
回复 使用道具 举报
感觉还可以再简练啊,一般开发不这样用。
回复 使用道具 举报
敲。。。狂敲。。。。
回复 使用道具 举报
多练练  初学都会觉得挺困难的
回复 使用道具 举报
多练练就好了  找找实战项目  实在不行就手写
回复 使用道具 举报
多敲代码,慢慢就懂得里面的代码结构啦
回复 使用道具 举报
多敲吧,我也要加紧多敲!
回复 使用道具 举报
按着思维一步一步来,不用记的。
回复 使用道具 举报
戒邪淫,多锻炼,多吃蔬菜和坚果~ 少吃肉。
回复 使用道具 举报
定义一个学生类有两条属性姓名+年龄,main方法里new三个对象,再放到一个数组里,循环输出。不要生记代码,根据思想自己写
回复 使用道具 举报
多敲多练,熟能生巧。还有就是面向对象部分多看看理解一下,无非就是属性、方法,然后调用,逻辑关系搞清楚了就简单了。要不你记再多代码,换一个类你又懵了
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马