Java Technical Lead

20+ Java Technical Lead Interview Questions and Answers

Updated 24 Sep 2024

Popular Companies

search-icon

Q1. Internals of JVM. Where is class , variables , objects stored in JVM

Ans.

Classes, variables, and objects are stored in different areas of JVM's memory.

  • Classes are stored in the method area of JVM's memory.

  • Variables are stored in the stack or heap depending on their scope and lifetime.

  • Objects are stored in the heap area of JVM's memory.

  • Static variables are stored in the method area.

  • Local variables are stored in the stack.

  • Instance variables are stored in the heap.

  • Primitive data types are stored in the stack.

  • References to objects are stored in the st...read more

Q2. Exceptions code snippets to guess output. How to convert checked exception to unchecked exception

Ans.

To convert checked exception to unchecked exception, use RuntimeException or create a custom unchecked exception.

  • Use RuntimeException to wrap checked exceptions and throw them as unchecked exceptions

  • Create a custom unchecked exception by extending RuntimeException class

  • Use try-catch block to catch checked exceptions and throw them as unchecked exceptions

Q3. What is streams and how to get distinct objects Whats are conventions we follow for rest api Spring mvc error handling and spring boot configuration annotations

Ans.

Streams in Java and conventions for REST API. Spring MVC error handling and Spring Boot configuration annotations.

  • Streams are a sequence of elements that can be processed in parallel or sequentially.

  • To get distinct objects, use the distinct() method.

  • Conventions for REST API include using HTTP methods, status codes, and resource naming.

  • Spring MVC error handling can be done using @ExceptionHandler annotation.

  • Spring Boot configuration annotations include @Configuration, @EnableA...read more

Q4. what is the difference between stream and parallel stream

Ans.

Stream is sequential while parallel stream is concurrent

  • Stream is a sequence of elements that can be processed sequentially

  • Parallel stream is a sequence of elements that can be processed concurrently

  • Parallel stream can improve performance for large datasets

  • Parallel stream uses multiple threads to process elements in parallel

  • Stream is suitable for small datasets or when order of processing is important

Are these interview questions helpful?

Q5. Design patterns used in Microservice architecture. API Gateway

Ans.

Design patterns like API Gateway, Circuit Breaker, Service Registry, and Service Discovery are commonly used in Microservice architecture.

  • API Gateway pattern is used to provide a single entry point for all clients to access the microservices.

  • Circuit Breaker pattern is used to prevent cascading failures in microservices.

  • Service Registry pattern is used to keep track of all the available services in the microservice architecture.

  • Service Discovery pattern is used to locate the a...read more

Q6. Why we need 2 way SSL?

Ans.

2 way SSL is needed for mutual authentication between client and server.

  • 2 way SSL ensures that both client and server are authenticated

  • It provides an extra layer of security by verifying the identity of both parties

  • It is commonly used in financial transactions, healthcare, and government applications

Share interview questions and help millions of jobseekers 🌟

man-with-laptop

Q7. What is the Controller Advice?

Ans.

Controller Advice is a mechanism in Spring MVC to handle exceptions globally.

  • It is used to handle exceptions across multiple controllers.

  • It can be used to add common data to the model.

  • It can be used to customize the response status code and message.

  • It can be used to redirect to a custom error page.

Q8. How to group by in streams

Ans.

Grouping by in streams in Java

  • Use the 'groupingBy' method from the 'Collectors' class

  • Pass a lambda expression to specify the grouping criteria

  • The result is a Map with the grouping criteria as keys and the grouped elements as values

Java Technical Lead Jobs

Java Technical Lead 6-8 years
Sopra Steria
3.9
₹ 15 L/yr - ₹ 20 L/yr
Noida
Java Technical Lead/ Lead Java Backend Developer 8-13 years
Atyeti
4.3
Pune
Java Technical Lead 9-13 years
Capgemini
3.8
Chennai

Q9. What is Decorator design pattern

Ans.

Decorator pattern adds behavior to an object dynamically without affecting its existing behavior.

  • It is a structural pattern

  • It involves a component interface, concrete component, decorator interface, and concrete decorator

  • Decorators wrap around components to add new behavior

  • It allows for flexible and dynamic behavior modification

  • Example: Java I/O streams use decorator pattern

Q10. What is marker interface

Ans.

A marker interface is an interface with no methods used to mark a class as having a certain property or behavior.

  • Marker interfaces are used to provide metadata about a class.

  • They are often used in frameworks and libraries to indicate that a class should be treated in a certain way.

  • Examples include Serializable, Cloneable, and Remote interfaces in Java.

  • Marker interfaces can also be used to enforce design patterns, such as the Decorator pattern.

  • Marker interfaces are different f...read more

Q11. Usage of Kafka and Kafka Streams

Ans.

Kafka is a distributed streaming platform used for building real-time data pipelines and streaming applications.

  • Kafka is used for building real-time data pipelines and streaming applications

  • Kafka Streams is a client library for building applications and microservices that process streams of data

  • Kafka provides fault-tolerant storage and processing of streams of records

  • Kafka Streams allows for stateful and stateless processing of data

  • Kafka can be used for various use cases such...read more

Q12. Find occurance of each element of an array using Streams API

Ans.

Using Streams API to find occurrence of each element in an array of strings

  • Use Arrays.stream() to convert the array to a stream

  • Use Collectors.groupingBy() to group elements by their occurrences

  • Use Collectors.counting() to count the occurrences of each element

Q13. what are the idempotent methods in REST API call

Ans.

Idempotent methods in REST API calls are operations that can be repeated multiple times without changing the result beyond the initial application.

  • GET method is idempotent as it retrieves data and does not change the state of the server

  • PUT and DELETE methods are also idempotent as they perform the same operation regardless of how many times they are called

  • POST method is not idempotent as it creates a new resource each time it is called

Q14. what are java 8 new features

Ans.

Java 8 introduced lambda expressions, streams, default methods, and more.

  • Lambda expressions for functional programming

  • Streams for efficient processing of large data sets

  • Default methods to add new functionality to existing interfaces

  • Date and Time API for improved handling of date and time

  • Optional class to avoid null pointer exceptions

  • Nashorn JavaScript engine for improved performance

  • Parallel array sorting for faster sorting of large arrays

Q15. how we can improve microservice security

Ans.

Improving microservice security involves implementing authentication, authorization, encryption, and monitoring.

  • Implement strong authentication mechanisms such as OAuth or JWT

  • Use role-based access control for authorization

  • Encrypt sensitive data in transit and at rest

  • Implement monitoring and logging to detect and respond to security incidents

Q16. Sort strings on the basis of city.

Ans.

Sort strings based on city names.

  • Use Arrays.sort() method with a custom Comparator to sort strings based on city names.

  • Create a Comparator that compares the city names of two strings.

  • Example: String[] cities = {"New York", "London", "Paris"};

  • Example: Arrays.sort(cities, (a, b) -> a.compareTo(b));

Q17. Difference between PUT and POST

Ans.

PUT is used to update or replace 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, meaning multiple identical requests may have different effects.

  • PUT is used when the client knows the URI of the resource it wants to update.

  • POST is used when the client does not know the URI of the resource it wants to create.

Q18. Microservices with Kubernate deployment

Ans.

Microservices with Kubernate deployment involves breaking down an application into smaller, independent services and deploying them using Kubernetes.

  • Microservices architecture involves breaking down a monolithic application into smaller, independent services that can be developed, deployed, and scaled independently.

  • Kubernetes is a container orchestration platform that automates the deployment, scaling, and management of containerized applications.

  • Deploying microservices with ...read more

Q19. Find 2nd max element.

Ans.

Find 2nd max element in an array of strings.

  • Sort the array in descending order

  • Return the element at index 1

Q20. Use of static in main function

Ans.

Using static in main function allows it to be called without creating an instance of the class.

  • Static in main function allows it to be called directly without creating an object of the class.

  • Static methods can be called using the class name itself, without creating an object.

  • Example: public static void main(String[] args) { }

Q21. Internal working of HashMap?

Ans.

HashMap is a data structure that stores key-value pairs and uses hashing to efficiently retrieve values.

  • HashMap internally uses an array of linked lists to store key-value pairs.

  • When a key-value pair is added, the key is hashed to find the index in the array where it will be stored.

  • If multiple keys hash to the same index, a linked list is used to handle collisions.

  • Retrieving a value involves hashing the key to find the index and then traversing the linked list to find the val...read more

Frequently asked in, ,
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Interview experiences of popular companies

3.7
 • 10k Interviews
3.9
 • 7.8k Interviews
3.7
 • 7.3k Interviews
3.8
 • 5.4k Interviews
3.6
 • 3.7k Interviews
3.8
 • 1.4k Interviews
3.4
 • 771 Interviews
4.2
 • 394 Interviews
3.6
 • 337 Interviews
3.7
 • 295 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 Technical 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
Get AmbitionBox app

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