Java Technology Lead

10+ Java Technology Lead Interview Questions and Answers

Updated 4 Apr 2022
Q1. Where are instance variables of an object stored in the JVM?

Q2. How do you define 'many-to-many' relationship in Hibernate when there are no common columns between two tables?

Ans.

Many-to-many relationship in Hibernate without common columns

  • Create a third table with foreign keys to both tables

  • Use @ManyToMany annotation in both entity classes

  • Specify the join table name and column names in @JoinTable annotation

Q3. What is a marker interface in Java?

Q4. How do you find the second largest integer in an array without using collections or without sorting the array?

Ans.

Find second largest integer in an array without sorting or using collections.

  • Iterate through array and keep track of largest and second largest integers.

  • Compare each element with current largest and second largest integers.

  • Return second largest integer.

Are these interview questions helpful?
Q5. What is the architecture of Kubernetes?
Q6. What is an API Gateway?

Share interview questions and help millions of jobseekers 🌟

man-with-laptop

Q7. How does PUT method behave when there is no data to update?

Ans.

PUT method updates data if available, else returns success with no changes.

  • PUT method updates the resource if it exists, else creates a new resource

  • If no data is provided, the server returns a success response with no changes made

  • Example: PUT /users/1 with empty body will return success with no changes if user with id 1 exists

Q8. What is the difference between the Factory and Abstract Factory design patterns?

Java Technology Lead Jobs

Java Tech Lead (Java & SpringBoot & React JS) 6-10 years
Oracle
3.7
₹ 15 L/yr - ₹ 23 L/yr
Mumbai
Java Tech Lead 4-7 years
Applied Materials India Private Limited
3.8
Mumbai
Java Tech Lead 7-10 years
Applied Materials India Private Limited
3.8
Bangalore / Bengaluru

Q9. How do you make sure some default code executes when the Spring boot applications starts up?

Ans.

Use @PostConstruct annotation or implement CommandLineRunner interface

  • Use @PostConstruct annotation on a method that needs to be executed on startup

  • Implement CommandLineRunner interface and override run() method

  • Add the code that needs to be executed on startup in the method annotated with @PostConstruct or in the run() method

  • Example: @PostConstruct public void init() { //code to be executed on startup }

  • Example: public class MyApp implements CommandLineRunner { public void run...read more

Q10. 1) How to communicate between two micro services?

Ans.

Microservices can communicate through synchronous or asynchronous protocols like REST, gRPC, or message brokers.

  • Use RESTful APIs for synchronous communication

  • Use message brokers like Kafka or RabbitMQ for asynchronous communication

  • gRPC can be used for high-performance synchronous communication

  • API Gateway can be used to manage communication between microservices

  • Consider using service mesh like Istio or Linkerd for more advanced communication needs

Q11. Whats the difference between @Service and @Component annotations?

Ans.

The @Service annotation is a specialization of the @Component annotation and is used to indicate that a class is a service.

  • Both @Service and @Component annotations are used to indicate that a class is a Spring-managed component.

  • @Service is a specialization of @Component and is used to indicate that a class is a service layer component.

  • The @Service annotation is used to add a layer of abstraction between the controller and the DAO layer.

  • The @Service annotation is used to provi...read more

Q12. What are Kafka Streams?

Q13. What does the HTTP error codes 400, 500 represent?

Ans.

HTTP error codes 400 and 500 represent client and server errors respectively.

  • HTTP error code 400 indicates a client-side error, such as a bad request or invalid input.

  • HTTP error code 500 indicates a server-side error, such as an internal server error or database connection issue.

  • Other common client-side errors include 401 (unauthorized), 403 (forbidden), and 404 (not found).

  • Other common server-side errors include 503 (service unavailable) and 504 (gateway timeout).

Q14. How does a concurrent Hash Map works internally?

Ans.

Concurrent Hash Map is a thread-safe implementation of Hash Map.

  • Uses multiple segments to allow concurrent access

  • Each segment is a separate hash table with its own lock

  • Segments are dynamically added or removed based on usage

  • Uses CAS (Compare and Swap) operation for updates

  • Provides higher concurrency than synchronized Hash Map

Q15. How do you define a composite Primary key?

Ans.

A composite primary key is a primary key that consists of two or more columns.

  • A composite primary key is used when a single column cannot uniquely identify a record.

  • It is created by combining two or more columns that together uniquely identify a record.

  • Each column in a composite primary key must be unique and not null.

  • Example: A table of orders may have a composite primary key consisting of order number and customer ID.

Q16. Difference between PUT and POST methods?

Ans.

PUT is used to update an existing resource while POST is used to create a new resource.

  • PUT is idempotent, meaning multiple identical requests will have the same effect as a single request.

  • POST is not idempotent and can result in multiple resources being created if the request is sent multiple times.

  • PUT requires the client to send the entire updated resource while POST only requires the necessary fields to create a new resource.

  • PUT is typically used for updating data while POS...read more

Q17. 2)What are SOLID principles?

Ans.

SOLID principles are a set of five design principles for writing maintainable and scalable code.

  • S - Single Responsibility Principle: A class should have only one reason to change.

  • O - Open/Closed Principle: Software entities should be open for extension but closed for modification.

  • L - Liskov Substitution Principle: Subtypes should be substitutable for their base types.

  • I - Interface Segregation Principle: Clients should not be forced to depend on interfaces they do not use.

  • D - ...read more

Q18. Explain Microservices design pattern?

Ans.

Microservices is a design pattern where an application is broken down into small, independent services that communicate with each other.

  • Each service is responsible for a specific task or feature

  • Services communicate with each other through APIs

  • Each service can be developed, deployed, and scaled independently

  • Allows for greater flexibility, agility, and resilience

  • Requires a strong focus on automation, monitoring, and testing

Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Interview experiences of popular companies

3.9
 • 404 Interviews
View all

Calculate your in-hand salary

Confused about how your in-hand salary is calculated? Enter your annual salary (CTC) and get your in-hand salary

Java Technology Lead Interview Questions
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter