What is the difference between an interface and an abstract class in Java?
An interface can only contain method signatures, while an abstract class can contain both method signatures and implementation. An interface can be implemented by multiple classes, while an abstract class can only be extended by one class.
What is the difference between a constructor and a method in Java?
A constructor is a special type of method that is used to initialize objects, while a method is a block of code that performs a specific task. A constructor has the same name as the class, while a method has a specific name.
What is the difference between a static and non-static method in Java?
A static method belongs to the class and can be called without creating an instance of the class, while a non-static method belongs to an instance of the class and can only be called after creating an object of the class.
What is the difference between a final and a non-final variable in Java?
A final variable is a constant and cannot be reassigned, while a non-final variable can be reassigned.
What is the difference between a for loop and a while loop in Java?
A for loop is used to iterate a specific number of times, while a while loop is used to iterate until a certain condition is met.
What is a JavaBean in Java?
JavaBeans are reusable software components that are written in the Java programming language. They are typically used for business logic and user interface elements.
What is a Java applet?
A Java applet is a small, dynamic Java program that can be embedded in a web page and run in a web browser.
What is a Java servlet?
A Java servlet is a Java program that runs on a server and generates dynamic web content.
What is a Java Virtual Machine (JVM)?
A JVM is a software implementation of a virtual machine that executes Java bytecode. It provides the runtime environment in which Java bytecode can be executed.
What is the difference between an ArrayList and a LinkedList in Java?
ArrayList is implemented using an array and provides faster random access to elements, while LinkedList is implemented using a linked list and provides faster insertion and deletion of elements.