0% found this document useful (0 votes)
2 views4 pages

Jpr5 Ritesh

The document contains practical programming exercises by Ritesh Athane, focusing on Java programming concepts. It includes implementations of multidimensional arrays, for-each loops for array elements, and operations with the Vector class. Each problem statement is accompanied by source code and its output.

Uploaded by

ssf7vtdpth
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)
2 views4 pages

Jpr5 Ritesh

The document contains practical programming exercises by Ritesh Athane, focusing on Java programming concepts. It includes implementations of multidimensional arrays, for-each loops for array elements, and operations with the Vector class. Each problem statement is accompanied by source code and its output.

Uploaded by

ssf7vtdpth
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

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:

You might also like