假设一个ArrayList列表包含{"red","red","green"},下面的代码执行后列表的内容为_________?Stringelement="red";for(inti=0;i<list.size();i++)if(list.get(i).equals(element)){list.remove(element);i--;}
A: {"red","red","green"}
B: {"red","green"}
C: {"green"}
D: {}
A: {"red","red","green"}
B: {"red","green"}
C: {"green"}
D: {}
举一反三
- 假设一个ArrayList列表包含{"red","red","green"},下面的代码执行后列表的内容为_________?Stringelement="red";for(inti=0;i<list.size();i++)if(list.get(i).equals(element))list.remove(element); A: {"red","red","green"} B: {"red","green"} C: {"green"} D: {}
- 假设ArrayListlist包含{“red”,“red”,“green”}。以下代码执行后的list是什么?Stringelement="red";for(inti=0;i<list.size();i++)if(list.get(i).equals(element))list.remove(element); A: {"red","red","green"} B: {"red","green"} C: {"green"} D: {}
- 假设一个ArrayList列表包含{"red","red","green"},下面的代码执行后列表的内容为_________?Stringelement="red";for(inti=list.size()-1;i>=0;i--)if(list.get(i).equals(element))list.remove(element); A: {"red","red","green"} B: {"red","green"} C: {"green"} D: {}
- 假设一个线性表包含元素{"red","green","red","green"}.下列代码执行后,线性表是______________?Stringelement="red";for(inti=list.size()-1;i>;=0;i--)if(list.get(i).equals(element))list.remove(element); A: {"red","red","green"} B: {"red","green"} C: {"green","green"} D: {"green"} E: {}
- 假设一个线性表包含元素{"red","green","red","green"}.下列代码执行后,线性表是______________?Stringelement="red";for(inti=list.size()-1;i>=0;i--)if(list.get(i).equals(element))list.remove(element); A: {"red","red","green"} B: {"red","green"} C: {"green","green"} D: {"green"} E: {}