These are the most common Java Programmer interview questions and how to answer them:
The main features of Java are Object-Oriented, Platform Independent, Simple, Secure, Architecture Neutral, Portable, Robust, Multithreaded, Interpreted, High Performance, Distributed, and Dynamic.
JVM (Java Virtual Machine) is an abstract machine that enables your computer to run a Java program. JRE (Java Runtime Environment) provides libraries, Java Virtual Machine, and other components to run applications written in Java. JDK (Java Development Kit) is a software development kit that includes JRE and necessary development tools.
Inheritance in Java is a mechanism where one object acquires all the properties and behaviors of a parent object. It is a key part of OOP (Object-Oriented Programming) and allows for the use of existing code, promoting code reusability and method overriding.
An abstract class can have instance methods that implement a default behavior. An interface can only have abstract methods (methods without a body) and static methods. Abstract classes can have member variables while interfaces cannot, and a class can extend only one abstract class but can implement multiple interfaces.
Polymorphism in Java is a concept that allows one interface to be used for a general class of actions. The specific action is determined by the exact nature of the situation. Polymorphism allows methods to do different things based on the object it is acting upon, mainly achieved through method overloading and method overriding.
The '==' operator compares references (memory addresses) while the 'equals()' method compares the content or state of the objects. In other words, '==' checks if both references point to the same object while 'equals()' checks if the values of the objects are the same.
View interview questions to other related jobs and how to answer them: