MapTest.java报错
错误:Gradle:执行失败的任务:应用:transformClassesWithDexForDebug。
> com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:过程‘命令’C:\ Program Files \ Java \ jdk1.8.0_73 \ bin \ Java。exe”完成了非零退出值1
运行MapTest.java出现这样的错误如何解决?
public class MapTest {
public Map<String, Student> students;
public MapTest() {
this.students = new HashMap<String,Student>();
}
public void testPut() {
Scanner console = new Scanner(System.in);
for (int i = 0; i < 3; i++) {
System.out.println("请输入学生ID:");
String ID = console.next();
Student st = students.get(ID);
if (st == null) {
System.out.println("请输入学生姓名:");
String name = console.next();
Student newStudent = new Student();
newStudent.getId();
newStudent.getName();
students.put(ID,newStudent);
System.out.println("添加学生:" + students.get(ID).getName());
i++;
}
}
}
public void testKeySet() {
Set<String> KeySet = students.keySet();
for (String stuId : KeySet) {
Student st1 = students.get(stuId);
if (st1 != null) {
System.out.println("学生:" + st1.getName());
}
}
}
public static void main(String[] args){
MapTest mt=new MapTest();
mt.testPut();
mt.testKeySet();
} }
public class Student {
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
private String id;
public String getId()
{
return id;
}
public void setId(String id) {
this.id = id;
}
public Set <Course>courses;
public Student(){
this.courses=new HashSet<Course>();
}
}