Computer Science, asked by minakshipriyansc, 3 months ago

Question 5
In Java, which of the following methods are declared by the Set interface:
1. addo)
2. remove()
3. delete()
4. contains()​

Answers

Answered by nityathakurmanali01
1

Answer:

Java - The Set Interface

Sr.No. Method & Description

1 add( ) Adds an object to the collection.

2 clear( ) Removes all objects from the collection.

3 contains( ) Returns true if a specified object is an element within the collection.

4 isEmpty( ) Returns true if the collection has no elements.

Answered by probrainsme104
0

Answer:

The methods which are declared by the set interface is add(), remove(), contains()

Explanation:

A Set may be a Collection that can't contain duplicate elements. It models the mathematical set abstraction.

The Set interface is the only method which is inherited from Collection and adds the restriction that duplicate elements are prohibited.

Set also adds a stronger contract on the behavior of the equals and hashCode operations, allowing Set instances to be compared meaningfully whether or not their implementation types differ.

  1. add(): Adds an object to the gathering.
  2. remove(): Removes a specified object from the gathering.
  3. contains(): Returns true if a specified object is a part within the gathering.

#SPJ3

Similar questions