0% found this document useful (0 votes)
8 views2 pages

Advanced Java Assignment

The document outlines an assignment for an Advanced Java course, focusing on the Java Collection Framework and related concepts. It includes questions on collection interfaces, cloning, serialization, iterators, and methods for manipulating collections, as well as practical programming tasks. Additionally, it compares different list types and interfaces, and requires students to implement Java programs demonstrating various collection functionalities.

Uploaded by

anoop
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

Advanced Java Assignment

The document outlines an assignment for an Advanced Java course, focusing on the Java Collection Framework and related concepts. It includes questions on collection interfaces, cloning, serialization, iterators, and methods for manipulating collections, as well as practical programming tasks. Additionally, it compares different list types and interfaces, and requires students to implement Java programs demonstrating various collection functionalities.

Uploaded by

anoop
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Advanced Java (BIS402)

Assignment Module 1

1. Describe the Java Collection Framework. List the interfaces, convenience abstract
classes and concrete classes under the collection interface.
2. Can a collection object be cloned and serialized?
3. What method do you use to add all the elements from one collection to another
collection?
4. How do you obtain an iterator from a collection object?
5. What method do you use to obtain an element in the collection from an iterator?
6. Can you use a foreach loop to traverse the elements in any instance of Collection?
7. When using a foreach loop to traverse all elements in a collection, do you need to use the
next() or hasNext() methods in an iterator?
8. Suppose the list1 is a list that contains strings red, yellow, and green and list2 is another
list that contains the string red, yellow, blue. Answer the following questions:
a. What are list1 and list2 after executing [Link](list2)?
b. What are list1 and list2 after executing [Link](list2)?
c. What are list1 and list2 after executing [Link](list2)?
d. What are list1 and list2 after executing [Link](list2)?
e. What are list1 and list2 after executing [Link](list2)?
f. What are list1 after executing [Link]()?
9. What are the differences between ArrayList and LinkedList? Which list should you use
to insert and delete elements at the beginning of a list? Are all the methods in ArrayList
also in LinkedList? What methods are in LinkedList but not in ArrayList?
10. What are the differences between the Comparable interface and the Comparator
interface? In which package is Comparable, and in which package is Comparator?
11. How do you define a class A that implements the Comparable interface? Are two
instances of class A comparable? How do you define a class B that implements the
Comparator interface and override the compare method to compare to objects of type
B1? How do you invoke the sort method to sort a list of objects of the type B1?
12. How do you create a priority queue that reverses the natural order of the elements?
13. Suppose that set1 is a set that contains the strings red, yellow, and green, and that set2 is
another set that contains the strings red, yellow, and blue. Answer the following
questions:
a. What are in set1 and set2 after executing [Link](set2)?
b. What are in set1 and set2 after executing [Link](set2)?
c. What are in set1 and set2 after executing [Link](set2)?
d. What are in set1 and set2 after executing [Link](set2)?
e. What are in set1 and set2 after executing set1.
14. How do you sort the elements in a set using the compareTo method in the Comparable
interface? How do you sort the elements in a set using the Comparator interface? What
would happen if you added an element that could not be compared with the existing
elements in a tree set?
15. Implement a java program to demonstrate the following
a. ArrayList
b. Convert an ArrayList into an Array
c. Iterator
d. use the for-each for loop to cycle through Collection
e. A simple mailing list example
16. Write a java program to sort accounts by last name using comparator
17. Write a java program that demonstrate various Collection Algorithm
18. Write a program to implement a simple telephone number database that uses a property
list
19. List and explain the various methods of the following
a. Collection
b. List
c. Deque
20. List and explain various classes of Collection interface

You might also like