为了账号安全,请及时绑定邮箱和手机立即绑定

帮忙看看拿错了

package aaaa.imooc3;


import java.util.ArrayList;

import java.util.List;


public class ListTest {

public List coursesToSelect;

public ListTest(){

this.coursesToSelect = new ArrayList();

}

public void testAdd(){

Course cr1 = new Course("1","数据结构");

coursesToSelect.add(cr1);

Course temp= (Course) coursesToSelect.get(0);

System.out.println("添加了课程:" + temp.id + ":" + temp.name);

}

public static void main(String args){

ListTest lt = new ListTest();

lt.testAdd();

}

}




package aaaa.imooc3;


import java.util.HashSet;

import java.util.Set;


public class Student {

public String id;

public String name;

public Set courses;

public Student(String id,String name){

this.id = id;

this.name = name;

this.courses = new HashSet();

}

}





package aaaa.imooc3;


public class Course {

public String id;

public String name;

public Course(String id,String name){

this.id = id;

this.name = name;

}

}


正在回答

1 回答

主函数错了

public static void main(String[] args){
}


1 回复 有任何疑惑可以回复我~
#1

liu4444 提问者

非常感谢!
2016-01-08 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

帮忙看看拿错了

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信