100+ Java Interview Q&A
100+ Java Interview Q&A
1. What is Java?
Answer: Java is a high-level, object-oriented programming language
developed by Sun Microsystems.
19.What is a constructor?
Answer: A constructor is a special method used to initialize objects. It
has the same name as the class and is called when an object of the
class is created.
28. Can we have multiple catch blocks for a single try block?
Answer: Yes, a try block can be followed by multiple catch blocks, each
handling a different type of exception.
41-50: Multithreading
74. How can you create a simple client-server application in Java using
sockets?
Answer: Create a ServerSocket on the server side, accept client
connections. On the client side, create a Socket and connect to the
server. Implement input and output streams for communication.
94. Explain the difference between Spring MVC and Spring Boot.
Answer:
Spring MVC: A web module in the Spring framework for building web
applications.
Spring Boot: A project within the Spring framework that simplifies the
configuration and deployment of Spring applications.