



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Java code examples for implementing and using ArrayList and Vector in Java. The examples include initializing, displaying, and performing various operations such as summing integers in ArrayList and removing elements from Vector. The document also includes menu-driven programs for finding the largest string in an ArrayList and sorting and finding the largest and smallest numbers in a Vector.
Typology: Cheat Sheet
1 / 6
This page cannot be seen from the preview
Don't miss anything!




1. Write a program that initializes ArrayList which initializes 10 integers in it. Display all the integers and sum of these integers.
package dsa_lab02; import java.util.*; public class DSA_Lab02 { public static void main(String[] args) { ArrayList
2. Write a program that initialize Vector of String data type. Initialize 10 strings in it and perform all the operations on it.
package dsa_lab02; import java.util.*; public class DSA_Lab02 { public static void main(String[] args) { Vector
HOME TASK
1. Create a ArrayList storing string objects. Write a menu driven program which: a. Displays the all the elements b. Displays the largest String
package dsa_lab02; import java.util.*; import java.util.ArrayList; public class DSA_Lab02 { public static void main(String[] args) { ArrayList
2. Create a Vector storing integer objects as an input. a. Sort the vector b. Display largest number c. Display smallest number
package dsa_lab02; import java.util.*; import java.util.Scanner; public class DSA_Lab02 { public static void main(String[] args) { Vector