Core Java Interview Questions for Selenium Java Interviews
Q: What is the difference between JDK, JRE, and JVM?
A: JDK (Java Development Kit) is for development, JRE (Java Runtime Environment) is for running Java
applications, and JVM (Java Virtual Machine) is the engine that executes Java bytecode.
Q: What are access modifiers in Java?
A: Access modifiers define the visibility of class members. Java has public, protected, default, and private
access levels.
Q: What is the difference between '=='' and '.equals()' in Java?
A: '==' compares reference (memory address), whereas '.equals()' compares the content of objects.
Q: What is a constructor?
A: A constructor is a special method used to initialize objects. It has the same name as the class and no
return type.
Q: What is method overloading and overriding?
A: Overloading is defining methods with the same name but different parameters. Overriding is redefining a
method in a subclass that already exists in the parent class.
Q: What is Polymorphism in Java?
A: Polymorphism allows methods to perform different tasks based on the object calling them. It includes
method overloading and overriding.
Q: What is an interface in Java?
A: An interface is a reference type in Java, similar to a class, that can contain only constants, method
signatures, default methods, static methods, and nested types.
Q: What are exceptions in Java?
A: Exceptions are problems that arise during program execution. Java has checked and unchecked
exceptions.
Q: What is the difference between ArrayList and LinkedList?
Core Java Interview Questions for Selenium Java Interviews
A: ArrayList uses dynamic arrays and is better for searching. LinkedList uses nodes and is better for
insertions/deletions.
Q: What is the difference between HashMap and Hashtable?
A: HashMap is non-synchronized and allows one null key. Hashtable is synchronized and doesn't allow any
null key or value.