Java Interview Questions
● Difference between C++ and Java
● Difference between JDK, JVM and JRE
● What is data type in java and its types?
● What is variable?
● What are different operators?
● What are Keywords?
● What are control statements?
○ Conditional statements( if, if-else, switch)
○ Loop statements (for, while, do-while)
○ Jump statements (break, continue)
OOP(Most IMP)
● What is Class?
● What is an Object?
● What is IS-A Inheritance?
○ Single level
○ Multi level
○ Hierarchical
○ Multiple (Not possible in java, Need to implement using Interface) IMP
○ Hybrid
● What is HAS-A inheritance?(Aggregation)
● What is Polymorphism and its types?
● Difference between method overloading and method overriding
● What is Runtime polymorphism and Compile time polymorphism?
● What is Dynamic binding?
● What is super, this, static, final and instanceOf keyword?
● What are wrapper classes?
● What is Object class?
● What is Encapsulation?
● What are packages and subpackages in java?
● What are Access modifiers in java?
○ public
○ private
○ default
○ Protected
● What is Abstraction?
● In how many ways abstraction can be achieved?
● Difference between interface and abstract class
● Implement Multiple inheritance using interface
Arrays/Strings
● What is an array? And its types (1D and 2D)
● What is String?
○ Why are strings immutable?
■ What is String constant pool?
○ What are different methods of string?
● What is StringBuffer?
● What is StringBuilder?
● What is the difference between StringBuffer and StringBuilder?
● What is the StringTokenizer class?
Exception Handling
● What is Exception handling?
● How will you handle exceptions?
● Difference between Compile time exception(Checked exception) and Runtime
exception(Unchecked Exception)
● Difference between throw and throws keyword?
● Difference between final, finally and finalize()
Multithreading
● What is Multithereading?
● In how many ways multithreading can be implement?
● Difference between multithreading and multitasking
● Difference between yield(), slep() and join() methods
JDBC
● Steps to implement JDBC
● What is Statement?
● What is PreparedStatement?
● What is ResultSet?
Collection framework
● Difference between Collections and Collection
● Difference between Array and ArrayList
● What are different collections available in java
○ List (ArrayList, LinkedList, Stack etc.)
○ Queue (LinkedList, PriorityQueue etc.)
○ Set (HashSet, TreeSet etc.)
○ Map (HashMap etc.)
Regular expressions(Just go through once)
Java 8 features
● What is Date and Time API?
● What is Functional interface?
● What is Lambda expression?
● What is Stream API (filter(), map() and reduce() functions)
● Static and default methods in interface
● What is marker interface (Serializable, clonable)
Spring Core
● What is Maven Project and Maven Repository?
● What is Spring framework?
● Difference between Spring, Spring MVC and Spring Boot
● Need of Spring framework
● What is dependency?
● What is dependency injection?
● What is Tight coupling?
● What is Bean?
● Life Cycle of bean (@PostConstruct, @PreDestroy)
● What is IOC Container?
● Types of IOC Container
● Different ways to inject dependency (Setter injection, Constructor injection,
Proxy object)
● Different ways of Autowiring (BY_NAME, BY_TYPE)
● What are Scopes in spring framework(Singleton, Prototype)?
● Use of @Value and @PropertyScouce?
Spring BOOT
● What is MVC Pattern?(Model, View and Controller)
● What is REST API?
● What is DispatcherServelet?
● What is @Controller?
● What is @Service ?
● What is @Configuration?
● What is @Repoitory?
● What is ORM?
● What is JPA?
● Wh do we use application.properties?
● Procedure to create REST APIs using Spring boot
● How will you test the REST API? (Using Postman)