当对Set类型的集合使用add()方法时,若方法返回false说明什么?()  

题目
单选题
当对Set类型的集合使用add()方法时,若方法返回false说明什么?()
A

 添加的元素不存在

B

 从集合中删除元素

C

 元素添加到集合中

D

 添加的元素在集合中已经存在

如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

您正在开发自定义集合类。您需要在类中创建方法。您需要确保在类中创建的方法返回与Foreach语句兼容的类型。该方法应满足哪个条件?()

A.该方法必须返回IEnumerator或IEnumerable类型

B.该方法必须返回IComparable类型

C.该方法必须明确包含集合

D.该方法必须是类中唯一的迭代器


参考答案:A

第2题:

在java中当方法没有返回值时,其类型必须是_________,可以省略return。

A.public

B.double

C.static

D.void


正确答案:D

第3题:

xpath中extract方法返回值类型是()

A、列表

B、元组

C、字典

D、集合


参考答案:A

第4题:

当子类中定义的方法与父类方法同名且参数类型及个数、返回值类型相同时,称子类方法覆写父类方法,子类默认使用本类已经覆写方法,使用父类的同名方法,必须使用()关键字说明。


正确答案:super

第5题:

有关return语句说法不正确的是( )

A)系统默认的返回值类型为整型,故当函数的返回值为int型时,在函数定义时,返回值的类型说明可以省略

B)当函数有返回值时,凡是允许表达式出现的地方,都可以调用该函数

C)当函数没有返回值时,函数的返回值类型可以说明为void型,它表示“无类型”或“空类型”

D)函数的返回值类型必须与return语句中的表达式值的类型一致,但c语言也允许不同;这时,系统以函数定义时的返回值类型说明为准,并自动地将return语句中表达式的值转换为函数的返回值类型


正确答案:D

第6题:

You are creating a Windows Communication Foundation (WCF) service that accepts messages from clients when they are started. The message is defined as follows:[MessageContract] public class Agent {

A. Add a MessageBodyMember attribute to the CodeName property and set the ProtectionLevel to Sign. Add a MessageBodyMember attribute to the SecretHandshake property and set the ProtectionLevel to EncryptAndSign.

B. Add a DataProtectionPermission attribute to the each property and set the ProtectData property to true.

C. Add an xmlText attribute to the CodeName property and set the DataType property to Signed. Add a PasswordPropertyText attribute to the SecretHandshake property and set its value to true.

D. Add an ImmutableObject attribute to the CodeName property and set its value property to true. Add a Browsable attribute to the SecretHandshake property and set its value to false.


参考答案:A

第7题:

set集合如何处理重复元素

A.如果加入一个重复元素将抛出异常

B.如果加入一个重复元素add方法将返回false

C. 集合通过调用equals方法可以返回包含重复值的元素。

D. 重复值将导致编译出错。


正确答案:B

第8题:

下面关于方法定义的描述中,正确的是()。

A、当方法没有返回值时,返回值类型可以不写

B、当方法没有返回值时,不能有return语句

C、方法是对功能代码块的封装

D、方法是不可以没有参数的


参考答案:C

第9题:

在public HttpSession getSession(boolean bool)的方法定义中,当bool为false时表明()

  • A、直接返回会话对象
  • B、当服务器已经创建了会话对象就返回该对象,否则返回null
  • C、直接返回null
  • D、当服务器已经创建了会话对象就返回该对象,否则新建一个会话对象并返回

正确答案:B

第10题:

集合的添加使用的方法是()

  • A、append
  • B、in
  • C、input
  • D、add

正确答案:D

更多相关问题