Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (2.6k points)

What is the main difference between Collection and Collections in Java?

1 Answer

0 votes
by (7.2k points)

The Collection is an interface whereas Collections is a utility class in JAVA. The Set, List, and Queue are some of the subinterfaces of Collection interface, a Map interface is also part of the Collections Framework, but it doesn't inherit Collection interface. The important methods of Collection interface are add(), remove(), size(), clear() etc and Collections class contains only static methods like sort(), min(), max(), fill(), copy(), reverse() etc.

 

Syntax for Collection Interface

public interface Collection<E> extends Iterable<E>

Syntax for Collections class

public class Collections extends Object

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...