Define Java.
A high-level, object-oriented programming language used for building applications.
What is the JDK?
Java Development Kit, a software development environment for developing Java applications.
True or false: Java is platform-independent.
TRUE
Java’s ‘write once, run anywhere’ capability is due to the Java Virtual Machine.
Fill in the blank: JVM stands for _______.
Java Virtual Machine
What does OOP stand for?
Object-Oriented Programming, a programming paradigm based on objects.
Define class in Java.
A blueprint for creating objects, containing fields and methods.
What is an object in Java?
An instance of a class that contains data and methods.
True or false: Java supports multiple inheritance.
FALSE
Java does not allow multiple inheritance to avoid complexity and ambiguity.
What keyword is used to create a class?
The keyword ‘class’ is used to define a class.
Fill in the blank: The main method signature is _______.
public static void main(String[] args)
Define method in Java.
A block of code that performs a specific task and can be called.
What is a constructor?
A special method used to initialize objects when they are created.
True or false: A constructor has a return type.
FALSE
Constructors do not have a return type, not even void.
What is inheritance?
A mechanism where one class acquires properties of another class.
Define encapsulation.
The bundling of data and methods that operate on that data within a class.
What is polymorphism?
The ability of a method to do different things based on the object it is acting upon.
Fill in the blank: Interface is a _______ in Java.
reference type, similar to a class, that can contain only constants, method signatures, etc.
What is the super keyword?
Used to refer to the immediate parent class object.
True or false: Java has primitive data types.
TRUE
Primitive types include int, char, boolean, and others.
What is an array?
A container object that holds a fixed number of values of a single type.
Define String in Java.
A sequence of characters, used to represent text.
What is exception handling?
A mechanism to handle runtime errors, allowing the program to continue execution.
Fill in the blank: The try block is used for _______.
code that might throw an exception.
What is the finally block?
A block that executes after try and catch, regardless of exception occurrence.