Key和ID關(guān)系
student 表中的 Key指明為ID Value為Student對象 ? 創(chuàng)建對象時(shí)的語句 Student newstudent=new Student(ID,name) 這是不是意味著key就是newstudent中的id呢?
student 表中的 Key指明為ID Value為Student對象 ? 創(chuàng)建對象時(shí)的語句 Student newstudent=new Student(ID,name) 這是不是意味著key就是newstudent中的id呢?
2018-08-03
舉報(bào)
2018-08-29
我覺key可以作為id,但是容易給新手弄混。
2018-08-04
students是Map的對象實(shí)例,ID是Key,value是Student對象;而newstudent是Student的對象實(shí)例,它的ID只是Student的屬性,與Map(就是students)中的ID不一樣。