Senior Java Developer Interview Question Series's
Omar Ismail
Senior Software Engineer @ Digitinary | Java 8 Certified? | Spring & Spring Boot?????? | AWS? | Microservices ?? | RESTFul Apis & Integrations ?? FinTech ?? | Open Banking ?? | Digital Payments and Transformation??
Thanks to the original writer:
https://medium.com/@rathod.ajay10
Senior Java Developer Interview Questions Series 1
Java
Senior Java Developer Interview Questions Series 2
ArrayList ar = Arrays.asList{1,2,3,4,5,6,7,8,9,10}
from the above list you have to find average of even numbers square using java 8
5. what is parallel processing in java 8, what are the uses of it.
Some Microservice related questions
let’s say there are A,B,C,D,E services and i want to restrict A to call to C,D,E. how will you do that?
Senior Java Developer Interview Questions Series 3
1. What is singleton design pattern?
That seemed easy right, now you should know how it work
a. How singleton works in term of Spring IOC containers, how it will behave?
b. And how singleton works in Core java or in a class how singleton will work, is it object per class or one object in whole jvm.
the answer is JVM creates and maintain object in terms of singleton pattern not the per class.
2. What are stateless bean in spring? name it and explain it?
3. What does Spring boot auto detect feature?
Now I have practical question that you should know in, order to know that you have really worked in java development
4. how to parse json to hashmap?
Ans = Use json library and use object mappers read values method to do that.
5. WAP to find duplicates in an array list?
6. Print Array list in descending order?
7. You should know how implement cache in java for eg. read about LRU cache implementation and which data structure is good for cache
8. One question Regarding JDBC which is quite old one but good to know
what does JDBC forName() method does for you when you connect to any DB?
9. How parse XML file with json in java?
10. Can we insert Null in Concurrent Hashmap?
11. How to create custom hashmap of size 2GB?
12. Can we insert null key in hashamp and hashtable?
you should know the collection framework in and out.
Also, for experienced java developer, Spring framework is must one.
Senior Java Developer Interview Question Series 4 (Fintech Company specific)
Its difficult to memorize above lifecycle flow, just remember how bean is initialized.
2. So follow-up question would be type bean scopes and what are prototype and request bean scopes?
3.?How would you call a methods before starting/loading an Spring boot applications ?
4. What is the Difference between @Component and @Service @respository @Controller annotations.
5. What exactly @SpringbootApplication annotation does?
6. How to build a restful webservice which is can fetch 1gb of data from database and send back without using Pagination, so question is if you have big size response how would you send back from a rest webservice?
7. How would you design a binary tree kind of data structure into database design, basically the interviewer wants to know how you would design a database in hierarchical way
Ans — Very good link to try and understand challenges and solution
8. How would you store millions of records in a table? How many tables it requires, any database pattern can you use here?
9. Tell me about Pros and cons of microservice architecture why we need that (justify what problem microservice architecture solves)
10. Tell me about Microservice patterns? (Recently people started asking about this, it must know some of them with examples).
Very good link to explore the patterns
12. follow-up question, which design pattern you have used and why?
I have been asked regarding read heavy and write heavy application, what pattern you can go for. I told them CQRS which is command query.
for database mostly SAGA pattern is used.
13. what is circuit breaker pattern have you used it?
Refer this →
Usually, we want to stop any error cascading to other component in microservice, to stop that we usually use circuit breakers.
Hystrix library from Netflix is very good library to use it in application.
14. How to call methods Asynchronously, in spring framework how can we do that?
FYI, you can use @Async annotation with executors to achieve that.
15. How to call other microservice asynchronously?
16. How to handle exception in spring framework? (using @ControlAdvice annotation)
17. How to break singleton design pattern? and what can we do to stop that?
18. In a database there is index, what is the datatype of index.
I hope you are getting good insights from the actual interview questions.
Senior Java developer Interview series 5 Questions (Core Java 8, Spring)
领英推荐
Object oriented Programming :
What is Method Overriding ?
Can we override static method ? Why Cant we do that?
Static methods cannot be overridden?because they are not dispatched on the object instance at runtime. The compiler decides which method gets called. Overloading is also called static binding, so as soon as the word static is used it means a static method cannot show run-time polymorphism.
Very good link to it, please refer that.
What is the use of static keyword in java ??(too basic right ?)
It means we’ll create only one instance of that static member that is shared across all instances of the class.
follow this link to better understand the concept.
What is Covariant type?
Do it yourself
Memory Management in Java:
Explain the memory management in java?
So, in java you don’t have to worry about the memory management like CPP, It good to know who this works in java. Especially after java 8 changes where there is major updates regarding to it.
In java 8, Permgen is replaced by Metaspace, we should be able to answer what advantage it offers.
What is MetaSpace in java 8 memory? what benefits it offers?
Basically, up till java 7, JVM stores all the static content in this memory section. This includes all the static methods, primitive variables, and references to the static objects.
Furthermore,?it contains data about bytecode, names, and JIT information. Before Java 7, the String Pool was also part of this memory. this was leading to?OutOfMemoryError?in java to reduce that Oracle removed permgen and added?MetaSpace which grows automatically and reduces?generating the famous?OutOfMemoryError.
JAVA-8 related Questions:
What is Functional interface in java 8 ?
Any interface which is having single abstract can be called as Functional Interface.
Examples:
interface FileFilter { boolean accept(File x); } interface ActionListener { void actionPerformed(…); } interface Callable { T call(); }
Types of Functional interface?
Some programming related question around Java 8.
What are the Intermediate and terminal operation in java 8?
· filter()
· map()
· flatMap()
· distinct()
· sorted()
· peek()
· limit()
· skip()
What is the terminal operation in java?
Java Streams Terminal Operations such as?AnyMatch, Collectors, Count, FindAny, FindFirst, Min, Max, NoneMatch, and AllMatch.
Write a Program find the duplicates in an array using stream api?
int[] arr = {1,2,3,5,5,6,6,5} print only duplicates using stream operations?
class Test{
public static <T> Set<T>
findDuplicateInStream(Stream<T> stream)
{
// Set to store the duplicate elements
Set<T> items = new HashSet<>();
// Return the set of duplicate elements
return stream
// Set.add() returns false
// if the element was
// already present in the set.
// Hence filter such elements
.filter(n -> !items.add(n))
// Collect duplicate elements
// in the set
.collect(Collectors.toSet());
}
// Driver code
public static void main(String[] args)
{
// Initial stream
Stream<Integer> stream
= Stream.of(5, 13, 4,
21, 13, 27,
2, 59, 59, 34);
// Print the found duplicate elements
System.out.println(
findDuplicateInStream(stream));
}
}
Find the missing number in an Array?
example: int[] arr = {1,2,3,5,6} you need to find 4 that is missing in this.
Program to Find possible combination of given string “GOD” ?
do it yourself
Spring/Spring boot:
What is Spring bean lifecycle? (Really hate this question coz I don’t remember this big cycle at all)
A Spring bean needs to be instantiated when the container starts, based on Java or XML bean definition. The framework may also be required to perform some pre- and post-initialization steps to get the bean into a usable state.
After that, when the bean is no longer required, it will be removed from the IoC container. Like the initialization phase, the Spring framework may need to perform pre-and post-destruction steps to free the other system resources.
Difference Between BeanFactory and ApplicationContext ?
please use below link
What are the types of dependency injection and what benefit we are getting using that?
What is @ResponseBody Annotations?
What is horizontal scaling how to achieve that?
What is the difference between container and virtual machine?
What is Builder Design pattern?
Wonderful,very helpful and relevent Thanks for sharing!!!
Full Stack Software Developer | ERP | Java, Spring Boot, Angular, TypeScript, Ionic, SQL, Jasper Reports
1 年Nice
Thanks for sharing this.
Java Engineer with a focus on Spring Boot, Microservices and Docker/Kubernetes
2 年Jalal Hussain Barzi