Since collection interface extends Iterable interface, therefore, some people consider Iterable interface as the root interface.ġ7. What is the root interface of collection hierarchy in Java?Īnswer: The root interface of collection hierarchy in Java is collection interface. Care must be taken to use the appropriate cast operation.ġ6.What are the limitations of Collections Framework in Java?Īnswer: There are two limitations of collections framework in Java. It enables the reusability of the code.ī) Quality: Collections Framework improves the quality of code since the code is already tested and used by thousands of programmers.Ĭ) Speed: Collections Framework improves the performance of the applications, reduces the development time and the burden of designers, programmers, and users.ĭ) Maintenance: Since Java Collections framework code is open source and API documents are widely available, therefore, the code is easier to maintain written with the help of the collections framework.Į) Growable: The size of the collection container is growable in nature.ġ5. What are the main benefits/advantages of Collections Framework in Java?Īnswer: The main benefits/advantages of Collections Framework in Java are as follows:Ī) Reusability: Collections Framework in Java provides common classes and utility methods that can be used with various types of collections. G) Arrays can hold both primitives and object types whereas, collections can hold only objects but not primitive.ġ4. We can increase or decrease size based on our requirements.ī) Arrays are not recommended to use with respect to memory whereas collections are recommended to use with respect to memory.Ĭ) Arrays are recommended to use with respect to performance but collections are not recommended to use with respect to performance.ĭ) Arrays can store only homogeneous data elements (similar type of data) but collections can hold both homogeneous and heterogeneous elements.Į) Arrays do not support any method whereas collections support numerous types of methods. Or, Explain the difference between Collections and Arrays.Īnswer: The main difference between arrays and collections are as follows:Ī) Arrays are fixed in size/length but collections are growable in nature. What is the difference between Arrays and Collections in Java? What are the different components of collections framework?Īnswer: The different components of collections framework are interfaces, implementation classes, and algorithms.ġ3. Whereas, Collections Framework is a library of interfaces and implementation classes that provides the common architecture for creating, accessing, and updating the different types of collections.ġ2. These multiple elements are accessed through one Collection object. What is the main difference between Collection and Collections Framework in Java?Īnswer: Collection in java is an object that has multiple elements of the same type in a single entity. In which java package is the collections framework placed?Īnswer: The collections framework is placed in java.util package.ġ1. What is Collections Framework in Java?Īnswer: Collections framework in Java is a sophisticated hierarchy of numerous predefined interfaces and implementation classes that can be used to handle a group of objects as a single entity.ġ0. Or, what is the use of Collections in Java?Īnswer: Collections in Java can be used for storing multiple homogeneous and heterogeneous, duplicate, and unique elements without any size limitation.Īnswer: A set of several classes and interfaces which provide a ready-made architecture is called framework in java.ĩ. Which types of objects can be stored in a collection or container object?Īnswer: We can store both homogeneous and heterogeneous objects in the collection or container object.Īnswer: The multiple objects of a class that contains the same data are called duplicate objects in java.Īnswer: The multiple objects of a class that contains different data are called unique objects in java. Can we store a primitive data type into a collection?Īnswer: No, collections store only objects, not primitive data types values.Ĥ. Answer: No, a collection object works with reference types.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |