Java Seminar Questions-1
Java Seminar Questions-1
It demonstrates basic
input/output, data storage using
ArrayList, and simple calculations
like the average.
Output:
How many students? 4
Enter mark for student 1: 85
Enter mark for student 2: 90
Enter mark for student 3: 78
Enter mark for student 4: 92
Student Marks:
Student 1: 85
Student 2: 90
Student 3: 78
Student 4: 92
Benefits:
Automatically resizes.
-Uses a for loop and books.get(i) to display the list of books with
numbering.
Student Marks:
Student 1: 85
Student 2: 90
Student 3: 78
Student 4: 92
Output:
Books in Library:
1. The Alchemist
2. Harry Potter
3. To Kill a Mockingbird
Benefits:
Advantages:
Output:
Employee Salaries:
Alice - ₹50000
Bob - ₹45000
Charlie - ₹55000
-Prevent duplicates
Benefits:
Product Catalog:
- Keyboard
- Mouse
- Monitor
Advantages:
-Resizable
-Indexed access
Advantages:
Output:
Attendance List:
Alice
Bob
Charlie
Demonstrates how to store, manage, and sort a list
of custom objects (in this case, people) by a specific
attribute (age).
-int Integer
-double Double
int Integer
Definition: Automatic conversion of a wrapper class
object to its corresponding primitive
double type.
Double
Output:
Definition:
Generics allow a class or method to operate on objects
of various types while providing compile-time type safety.
Output:
Maximum Integer: 20
Maximum Double: 20.5
Maximum String: Cherry
Demonstrates the use of:
-Generic interface
-Generic class
-Generic constructor
Generic Interface:
Enables defining behavior for a key-value pair without
fixing the types in advance.
Generic Constructor:
It initializes the key and value fields.
Output:
Searching:
Uses containsKey() method to check if
an item exists.
Output:
By:
PRAJNA TRS
24BCE7992