1. Differentiate between a Class and an Object.
Class: A blueprint or template for creating objects; does not occupy memory until objects are created;
defines properties and behaviors.
Object: An instance of a class; occupies memory; represents actual behavior using class definition.
2. What are the four types of access modifiers?
public, private, protected, default.
3. Write a Java program to declare and initialize multidimensional array.
public class MultiArrayExample {
public static void main(String[] args) {
int[][] arr = {
{1, 2, 3},
{4, 5, 6},
{7, 8, 9}
};
for (int i = 0; i < [Link]; i++) {
for (int j = 0; j < arr[i].length; j++) {
[Link](arr[i][j] + " ");
[Link]();
4. List the types of constructors.
Default constructor, Parameterized constructor, Copy constructor.
5. Mention any four javadoc tags.
@author, @version, @param, @return.
6. Define interface.
An interface in Java is a reference type containing abstract methods (and default/static methods). A
class implements an interface to provide method definitions.
7. What are types of inheritance supported by Java?
Single, Multilevel, Hierarchical inheritance.
8. Write a Java program to access a super class field using super keyword.
class Parent {
int num = 100;
class Child extends Parent {
int num = 50;
void display() {
[Link]("Parent num: " + [Link]);
[Link]("Child num: " + num);
public class TestSuper {
public static void main(String[] args) {
Child c = new Child();
[Link]();
9. What is exception handling?
Exception handling is a mechanism in Java to handle runtime errors using try, catch, throw, throws, and
finally.
10. What are checked and unchecked exceptions in Java?
Checked exceptions: Exceptions checked at compile time (e.g., IOException, SQLException).
Unchecked exceptions: Exceptions checked at runtime (e.g., NullPointerException,
ArithmeticException).
1. What do you mean by threads in Java?
A thread in Java is the smallest unit of a program that can run independently. It represents a lightweight
subprocess and enables multitasking by allowing multiple parts of a program to run concurrently.
2. Give the difference between process and thread.
Process vs Thread:
- Process: Independent executing program with its own memory space, heavyweight, slow
communication, crash doesn’t affect others.
- Thread: Sub-part of a process sharing the same memory, lightweight, fast communication, crash may
affect whole process.
3. What is stream?
A stream in Java is a sequence of data (bytes or characters) that supports input and output operations.
4. List the byte stream classes.
Input Byte Streams: FileInputStream, ByteArrayInputStream, FilterInputStream, BufferedInputStream,
DataInputStream.
Output Byte Streams: FileOutputStream, ByteArrayOutputStream, FilterOutputStream,
BufferedOutputStream, DataOutputStream.
5. Enlist the two common constructors of FileInputStream.
- FileInputStream(String fileName)
- FileInputStream(File file)
6. What is the need of Generic Programming?
Generic programming is needed to enable type safety, avoid ClassCastException, allow code
reusability with parameterized types, and improve readability and maintainability.
7. What are various features of JavaFX?
Features: Rich UI controls, CSS styling support, FXML, 2D/3D graphics, animation and media support,
hardware acceleration, easy Java integration.
8. Which method is used to launch JavaFX application?
The launch() method from the Application class.
9. Define event source object.
An event source object is the component that generates an event and sends it to listeners.
10. Define property binding in JavaFX.
Property binding allows one UI component’s property to automatically update when another changes.