This OOP principle restricts direct access to an object’s data and provides methods to access it safely.
What is Encapsulation?
A blueprint for creating objects in Java is called a…
What is a Class?
A GUI element that displays text or images but does not allow user input is called a…
What is a Label?
In Java, code that might throw an exception is placed inside this block.
What is a try/ try block?
try { System.out.println("Start");
int a = 10;
int b = 0;
int result = a / ++b;
System.out.println("End");
} catch (ArithmeticException e)
{ System.out.println("Caught an exception");
}
What is start end?
A class can inherit attributes and methods from another class using this OOP concept.
What is inheritance?
An instance of a class is referred to as a…
What is an Object?
This GUI component allows a user to select multiple options
What is a checkbox / What are checkboxes?
DOUBLE POINTS
This block handles an exception if it occurs in the try block.
What is a catch / catch block?
int a = 5, b = 0;
System.out.println((a++ / ++b) + b);
What is 6
When a method behaves differently depending on the object that calls it, this concept is in action.
What is polymorphism?
This type of method is automatically executed when an object is created.
What is a Constructor?
Users can type data into this GUI component, often a single-line area.
What is a Text Field?
Code inside this block always executes, regardless of whether an exception occurs.
class A {
void show(){
System.out.println("A");
} }
class B extends A { void show(){ System.out.println("B"); }
}
A obj = new B();
obj.show();
What is B?
This OOP principle allows you to define a class with abstract methods that must be implemented by subclasses.
What is abstraction?
DOUBLE POINTS
Keywords like public, private, and protected are used in Java to define these.
What are Access Modifiers?
A GUI layout manager that arranges components in an equally divided structure is called…
What is GridLayout?
This is the general term for problems detected during program execution, like dividing by zero.
What is an Exception?
class Test {
private int x = 10;
}
System.out.println(new Test().x);
What is error?
When a subclass provides its own version of a method defined in its superclass, this is called…
What is Method Overriding?
A reusable block of code inside a class that performs a specific task is called a…
What is a Method?
This is code that responds to user actions such as clicks or typing.
What is an event listener?
DOUBLE POINTS
This Java keyword is used to manually throw an exception when a certain condition occurs.
What is throw?
try {
System.out.print("Try ");
} finally {
System.out.print("Finally");
}
What is try finally?