1.
Write a Java program to demonstrate implicit type conversion (widening) from int to
double.
Viva questions:
1. What is garbage collection in Java?
2. What are the four pillars of Object-Oriented Programming in Java?
3. What is bytecode in Java?
4. What is type conversion in Java?
[Link] is implicit type conversion?
[Link] a Java program to demonstrate constructor chaining in a multilevel inheritance.
1. What is garbage collection in Java?
2. What are the four pillars of Object-Oriented Programming in Java?
3. What is bytecode in Java?
4. What is constructor chaining in Java?
[Link] is the super() keyword used in constructor chaining?
[Link] a Java program to convert a String to int using [Link]().
1. What is garbage collection in Java?
2. What are the four pillars of Object-Oriented Programming in Java?
3. What is bytecode in Java?
4. What is the use of [Link]() in Java?
5. What type of value does [Link]() return?
[Link] a Java program to demonstrate nested if statements to find the largest of three
numbers.
1. What is garbage collection in Java?
2. What are the four pillars of Object-Oriented Programming in Java?
3. Can this program be written using if–else if?
4. What happens if two numbers are equal in this program?
5. Which condition is checked first in nested if statements?
[Link] a Java program to demonstrate thread synchronization using a synchronized
method.
1. What are the four pillars of Object-Oriented Programming in Java?
2. What is bytecode in Java?
[Link] is thread synchronization in Java?
4. Why is the synchronized keyword used?
5. What happens if the method is not synchronized?
[Link] a Java program to demonstrate explicit type casting (narrowing) from double to int.
1. What is garbage collection in Java?
2. What are the four pillars of Object-Oriented Programming in Java?
3. What is bytecode in Java?
[Link] is typecasting in Java?
5. What is the difference between implicit (widening) and explicit (narrowing)
typecasting?
7. Write a Java program to read data from a file using FileReader.
1. What is garbage collection in Java?
2. What is bytecode in Java?
[Link] is FileReader in Java?
4. Which package is required to use FileReader?
5. What is the main purpose of FileReader?
8. Write a Java program to demonstrate set operations like union and intersection using
HashSet.
1. What is garbage collection in Java?
2. What are the four pillars of Object-Oriented Programming in Java?
3. What is bytecode in Java?
9. Write a Java program to create and use a custom exception by extending the Exception
class.
1. What is garbage collection in Java?
2. What are the four pillars of Object-Oriented Programming in Java?
3. What is bytecode in Java?
4. What is a HashSet in Java?
5. Which package is required to use HashSet?
10. Write a Java program to demonstrate the difference between static and non-static
members.
1. What is garbage collection in Java?
2. What is a static method in Java?
3. What is a non-static method in Java?
4. How do you call a static method? Do you need an object?
5. How do you call a non-static method? Can it be called without creating an object?