Name: Ritesh Athane
Roll No.:2203
Batch No.:A1
Practical No: 05
Problem Statement 1: Write a program to implement multidimensional array.
Source Code:
class MultiDimensionalArray {
public static void main(String[] args)
{
int arr[][] = {
{1, 2, 3},
{4, 5, 6}
};
[Link]("Multidimensional Array Elements:");
for (int i = 0; i < [Link]; i++) {
for (int j = 0; j < arr[i].length; j++) {
[Link](arr[i][j] + " ");
}
[Link]();
}
}
}
Output:
Name: Ritesh Athane
Roll No.:2203
Batch No.:A1
Problem Statement 2: Write a program to display array elements using for-each loop.
Source Code:
class ForEachArray {
public static void main(String[] args) {
int arr[] = {10, 20, 30, 40, 50};
[Link]("Array Elements:");
for (int num : arr) {
[Link](num);
}
}
}
Output:
Name: Ritesh Athane
Roll No.:2203
Batch No.:A1
Problem Statement 3: Write a program to insert different elements in the Vector & display
them
Source Code:
import [Link];
class VectorInsert {
public static void main(String[] args) {
Vector<Object> v = new Vector<>();
[Link](10);
[Link]("Java");
[Link](25.5);
[Link](true);
[Link](v);
}
}
Output:
Name: Ritesh Athane
Roll No.:2203
Batch No.:A1
Problem Statement 5: Write a program to use different methods of Vector class.
Source Code:
import [Link];
class VectorMethods {
public static void main(String[] args) {
Vector<String> v = new Vector<>();
[Link]("Java");
[Link]("Python");
[Link]("C++");
[Link](v);
[Link]("Size: " + [Link]());
[Link]("Capacity: " + [Link]());
}
}
Output: