Java_Programming_QA_Sample_Answers
Java_Programming_QA_Sample_Answers
Q: 2 Marks
A: 1. Platform Independent
2. Object Oriented
3. Robust
4. Secure
arguments.
Example:
class MyClass {
int x;
MyClass(int i) { x = i; }
Q: Write a Java Program to create a class Employee with data members id, name, and salary.
Accept details of 5 employees and display the employee having the highest salary.
Q: 2 Marks
A: An interface is a reference type in Java, similar to a class, that can contain only constants,
Q: 4 Marks or 6 Marks
Q: Define the interface Shape with two methods: area() and perimeter(). Create two classes Circle
and Rectangle implementing the interface and write a program to demonstrate polymorphism.
Q: 2 Marks
A: Errors are serious issues not intended to be caught by applications (e.g., OutOfMemoryError).
Exceptions are conditions that applications may want to catch (e.g., IOException).
Q: 4 Marks or 6 Marks
Exception).
Q: Write a program to print even and odd numbers using two threads.
Q: Explain the concept of Exception Handling with syntax of try-catch-finally blocks. Provide a
suitable example.
Q: Define exception called 'No Match Exception' that is thrown when the password accepted is not
Q: 2 Marks
Q: Enlist any two layout managers.
Q: 4 Marks or 6 Marks
Q: 2 Marks
Q: 4 Marks or 6 Marks
Q: 2 Marks