Must-know Java interview questions
3 reported frequent at Accenture, Deloitte, Infosys and 1 more. “Reported” because the company tags have no public source. Every quick answer is free.
- Questions on this page
- 3
- Must know
- 0
- picked by the editor
- Reported frequent
- 3
- company tags, reported
- Companies
- 4
- with a frequent tag
Reported frequent· 3
Tagged as frequent at a company. Reported: the tags have no public source.
- What are the four pillars of OOP and how does Java implement each?Encapsulation hides data behind access modifiers and getters and setters. Inheritance reuses code by
extendsandimplements. Polymorphism uses method overriding (dynamic dispatch) and overloading. Abstraction uses abstract classes and interfaces. These are the four OOP (object-oriented programming) pillars of Java.BeginnerFreeReported frequent at Infosys+1 - What is the difference between an abstract class and an interface?An abstract class is a partially implemented class you
extends(single inheritance); it can have constructors, instance fields and any access modifiers. An interface is a contract youimplements(many allowed): fields are implicitlypublic static final, and since Java 8 it can havedefaultandstaticmethods.IntermediateFreeReported frequent at Deloitte - What is the difference between method overloading and method overriding?Overloading means several methods in one class share a name but have different parameters; the compiler picks one (compile-time polymorphism). Overriding means a subclass replaces a superclass method with the same signature; the JVM picks it at runtime (runtime polymorphism, dynamic dispatch).IntermediateFreeReported frequent at Accenture