This video provides an efficient, albeit formulaic, roadmap for navigating the standard corporate Java gauntlet. It successfully condenses years of ecosystem evolution into a digestible checklist for those prioritizing interview survival over deep architectural nuance.
深掘り
前提条件
- データがありません。
次のステップ
- データがありません。
深掘り
Java Spring Boot 3 Yrs Interview Experience追加:
Hey guys, today we have a fun and he's having total three years of experience in Java Spring Boot and microservices.
And guys, those who want to give same framework interview, please fill out the form below in the description. So, now let's get started. Yeah, hello fun. How are you?
Hi Faizan, I'm fine. How about you? Yes, I'm also good. Shall we start?
Yes, yes Faizan. Okay, so Afan, can you please introduce yourself and your recent project in brief?
Yeah, I'm Sheikh Afan as a Java developer. I have an experience of 3 years in designing developing software solution. I specialize in core Java, Spring Boot, Hibernate, restful APIs services. My recent project was one of the leading company. I have been deployed to the one of the high profile client where I have been work with a station development management system for the project. So, prior to this, I also have an experience with the other company which I have been square shipping project, booking and tracking management module where I have been done with the truck model. This is my simple introduction. So, since I have been work with the client, I have been experience with the live bug fixings and This is my simple introduction. Okay, got it.
Okay, so Afan, uh I think you are using Java 8 version in your project or maybe Java 8 plus 11 17, right? So, I just want to know one thing. Uh in after Java 8, we have default method, private method, static methods in interfaces.
All right? So, I just want to I just want to know the reason behind it.
Uh in the Java 8, default method, private method, static method was introduced due to in the in the interface, we have only the public static and we have only the method which is which do not have an implementation at that time. Mhm. So, due to that constant of the it do not have an implementation with the child class, then default method was been introduced in the Java 8. Okay.
>> To make our custom logic.
Okay, so Afan, if a class if a class implements two interfaces that both have a default method with the same signature, Okay. so, what will happen?
It will get the ambiguity issues.
Correct.
>> With the two different It will give compilation error.
Compilation >> The class must explicitly override the conflicting method, right?
Yes. Okay, Afan, can you tell me can a abstract sorry, can an abstract class have a constructor?
An abstract class don't have an do not create any object. Mhm.
>> So, in my understanding, it doesn't have any constructor in it. We have only abstract methods on it.
Okay. Uh but the answer is yes, abstract classes can have constructors. But we cannot instantiate them directly.
By a new abstract class is uh it's basically a compilation error.
>> object of that abstract class. The constructor may be called via super method.
Yes, yes.
>> From the concrete sub class, okay?
Yes.
Okay, got it.
So, just tell me one thing. Uh why does integer I N T E G E R is equal to is equal to integer work for a small numbers but fail for larger ones?
You got it?
Yeah, due to uh It is integer is a wrapper classes.
Okay, I'm saying let's say there are two integers integer A is integer B.
Okay, so if we do A is equal to is equal to B, this will work uh for small numbers, but for large numbers, this will not work because let's say if we have A is equal to 1,000, B is equal to 1,000 and if we do A is equal to is equal to B, then it may return false.
Because integer is considered an object, right?
Integer is an object, yes. So, why it works for small numbers?
I if it was small numbers in terms of primitive data types or the just numbers Okay. Let me give you an example. If you have integer A is equal to 10 and integer B is equal to 10. So, okay?
When we'll do if A is equal to is equal to B, this will always return true.
>> Okay, but if we A is equal to 1,000 and B is equal to 1,000.
Right? This will not give you a true result. It will occupy the different memory locations.
Okay. Okay.
Let me tell you the answer. Actually, Java caches integer objects for values minus 128 to 127. You can miss >> Okay, so if you compare the values between minus 28 to 127, double equal works perfectly.
It will not treat these numbers a different object a different location.
But beyond 127, yes, you may see some incorrect inconsistent result, okay?
Okay, okay.
Okay. I would like to share one important thing with you. Actually, we had launched complete interview preparation material is structured step by step by myself expert in MNCs interviews. And the best part is that now no one need to go anywhere else to prepare the interviews, okay? There is a 99% chance that interviewers will ask questions from this material. So, basically, it contain a lot of material categorized by experience level means each experience level has different material with all possible interview question and answers for Java, Spring Framework, Maven, Git, Spring Boot, Spring Security, Spring Data JPA, Kafka, microservices, Java coding questions, stream API coding questions and many more. I have provided the link to get this in the below description. And if someone need this material, whole material plus two real enterprise client projects for the reference plus one-on-one lifetime doubt sessions and the referrals to the big MNCs, then they should check the interview preparation kit. I'll provide the link for this as well in the description below. So, now moving to our interview. Um can you explain what is method overloading and what is method overriding? And which is resolved at compile time and run time?
Uh method overloading is a same method name having in the same method name having with the different parameter, sequence of parameter, types of parameter would be changed in the method overloading. It is a compile time polymorphism. Method overriding is a run time polymorphism where method name would be the same but different parameter return type would be the different and sequence would be the different. This is a run time polymorphism.
Got it.
Can we achieve polymorphism without inheritance in Java?
Without inheritance, yes, we can achieve the polymorphism without inheritance.
Correct, we can achieve. Afan, can you tell me what's the difference between array list and linked list and when would you choose one over another?
Yeah, array list and linked list was a implementation of the list. In the array list, we have the index position. When we want to fetch the any data of the position, then we go with the array list. Linked list, it is internally work with the node representation. Okay. Uh doubly linked list, it it was internally work with the doubly linked list where we have a node representation. So, it would be the slow in the link in the in terms of linked list. Mhm.
Okay.
>> So, Okay, so you need to iterate over a list and removing matching elements.
What's a wrong way to implement it and what's a right way to implement it?
Uh sorry, could you please repeat it?
You need to iterate over a list and removing matching elements. Let's say you have a list 1 2 3 4 5 6 7 8 9 10 and you have an matching element for example 8 and you have to iterate a list and remove that matching element from the list.
So, what's a right way to do it?
Iterator dot Like would you use list array list?
Would you use linked list? Oh, sorry.
Um yes, linked list. Like what which which collection would you use and how would you use?
We go with the array list to iterate over the list list dot Okay.
>> We want to fetch the Yep, yep, yep. First, we will we will go through I mean, we'll use the array list or linked list, right? Uh but you will see concurrent modification exception because you are removing something while iterating.
>> we remove concurrent modification exception we use. We deal with the iterator dot remove method to prevent that concurrent modification exception while threads are accessing a uh while threads are accessing in the iterator, it will get the exception.
Correct, correct, correct. Okay.
Um so, uh let's say you want to store some integer values, okay?
In a pair.
Okay?
But uh you don't want to store the duplicates one.
Right?
But you have to maintain the order. So, which uh collection framework would you use?
Duplicate order should be maintained but uh There should be no duplicate elements.
You have to store the value as a key and value. There should be no uh duplicate keys, but the insertion order should be maintained.
Okay, insertion we go with the hash set.
Hash set? Are you sure? Uh Yeah, yeah.
Do we maintain the insertion order in a hash set or hash map?
In my head, yeah, hash map is a answer we do which maintain the orders.
Uh no, no, no. My question is uh let's say you have a stored the element in the hash map or hash set.
Uh do we I mean, hash set maintains insertion order?
For example, if you if you have inserted first one, then two, then three, then four, then five. So, does hash map provide guarantee that if If have inserted one first, then one should come first. If you have inserted two at the second time, then two should be there.
>> No, priority of order doesn't maintain in the hash. Doesn't maintain the hash map. So, I think we should use a different collection, and linked hash map, if you know.
Linked hash map maintains insertion order, right?
Yes. Yep, yep. So, in this case, we should use linked hash map.
Okay, so can you tell me what are lambda expressions and functional interfaces?
Uh lambda expression one of the feature of the Java 8, where it was being written for the concise and the crispy to make the code. So, in the functional interface, suppose we have an a written in the interface with a some method. We if we haven't taken a method, to use the to use that method, we use the lambda expression by >> [clears throat] >> lambda expression to call that particular uh particular method.
Okay.
So, in the lambda expression, we don't have any return type.
Okay. And there should be one um abstract method, right? In the functional interface.
>> abstract method in the interface.
Okay, let's say uh there is an interface, normal interface, that has one abstract method.
All right? Now, there is another functional interface.
Now, functional interface is implementing the normal interface.
And inside the functional interface, you have uh implemented one abstract method, because if you know uh like in functional interfaces, there must have one abstract method, right?
Is it possible?
As we have two interfaces, we have two abstract methods, right?
Mhm.
Uh First is interface A.
Interface A has one abstract method.
Second is functional interface B.
Implements A.
Now, inside functional interface B, you have one abstract method again.
Is this Is it possible?
Uh to implement the interface to implement the abstract method. Yep, yep.
Yeah, we can implement it by using the super.
Uh we need to choose which method we need to implement. Okay. Uh I think you didn't get my point. Uh There There are rules in functional interfaces. We cannot have more than one abstract method, right?
>> One abstract method, single abstract method we can do.
>> We have already one abstract method inside functional interface. If we implement another interface that has one more abstract method, then in total, we will have two abstract method.
In our child interface.
Yes, but there are the two interfaces we are dealing with it. First interface and second interface are two different interfaces.
>> They are two different interfaces, but if we have implemented first one, then in the second one, all the properties, I mean second will acquire all the properties of first one as well, right?
Yes, yes. It will be breaking It will break the rules, right? So, there there will be some compilation or run time errors, right?
Okay. Um moving ahead.
Can you tell me how stream API works? Do you know Have you worked with the stream API?
Yes, I don't work with the stream API.
Okay, okay. Please go ahead.
Uh stream API is a collection of objects, where we have the methods as filter, sort, and the map Okay.
the collection of objects. As an example, uh if you want to have the stations, some of the list of the stations we have, Mhm.
>> to get the in the order to get the only with the specific we need to start with the particular element with the start with the C, start with the J. Which station we are picking up. So, in that we apply with the stream filter, map in the map filter, and in the filter, we use the start with method, and we write that uh element. Correct, correct.
What's the difference between map and flat map?
The map is a one-to-one mapping. Map is for one-to-one mapping. Flat map is also one-to-many mapping.
One is not for the nested structure. Uh one is for the nested structure in the flat map.
Okay.
>> So, in the map, we use in the in example in we have used the DTO to entity and entity entity to DTO to map. We use the map method in it. In our project, we use it. And the flat map we use for the nested structure as a support we have in a project that every project has the particular employees. So, for every project has particular employees, we get into the in a single single stream. So, then we use the flat map.
Mhm, got it.
Uh what's the difference between a process and a thread?
Uh thread is a small unit of a program, where process is a uh uh where pro Thread is a small unit of program, and where pro process is a uh it is a part of the thread, multiple uh what we call Okay.
A process is basically an independent program with its own memory space, file handles, and operating resource, isolated from other processes.
Thread is a lightweight unit of execution within a process.
Within the process.
Uh in the project, context switching will be the difficult, and a thread is a very easy to context switching. So, process is a very expensive, and a thread is very lightweight. Correct, correct.
How can we create a thread in Java?
Uh we can create the thread in a Java by the two ways. One is a runnable interface, one is the extend with a thread. In the when we call the runnable interface, we have the implementation of the run method. We use to perform the task on it to execute that particular task.
Okay, got it.
Uh what is a race condition?
If multiple threads are accessing with the same multiple threads accessing the same resources, then we used to get the as race we used to get the data as a race condition, which makes the data as leak or corrupted. Okay.
Got it.
So, can you please tell me um how synchronized keyword works actually?
Uh suppose there are the two threads if are accessing with the same resources.
One thread is going to access in the uh resource one, and second thread is accessing for the resource two. But resource one is depending on the resource two, and resource two is depending on the resource one. There is a lock uh there would be the lock. Nothing would be released from the resource one to resource two. Then we use the synchronizer at the method level or the block level to prevent this uh race uh race conditions.
Okay, got it. Can you tell me what is executor service, and why should we use it instead of creating threads directly?
Uh I have not been worked with the executor service, but in conceptually, I know the executor service we use the executor service framework, where we use the multi uh where we multiple threads put into one place, and we give the every thread as a task to perform.
Okay.
Do you know about future?
No, I don't know.
I don't know.
>> Completable future?
No, no idea about the future.
>> idea.
Uh can you tell me what is dependency injection, and how does Spring implement it?
Uh dependency injection is a technique where we use in the in the Spring Boot, and we have the three types of dependency injection. One is the field injection, constructor injection, and the setter injection. So, in the field injection, suppose in the we have in a controller, we use we are we are making the dependency as service in that controller to get that business logic. Okay.
>> Or repository to get some operations of it. Then we use the at the rate auto to just private uh station service station service in the station controller. So, through this way, we use the field injection. In the setter injection or constructor in in the constructor injection, with the mandatory to work with it. In the setter injection, we don't we don't want to There is no mandatory on it. Mhm, mhm.
We use the at the rate auto wired for the dependency injection to work.
Got it, got it.
Um Why is field injection considered a bad practice compared to constructor injection?
In the field injection, we cannot the we cannot test we cannot test in the field injection. Mhm. Uh so, we don't use the much in the field injection. Constructor injection, suppose we have an account class and the transaction. Without the transaction, we could not perform the any accounts. So, it is mandatory to there in the constructor.
Okay.
So, that we use the mainly constructor injection.
Got it.
>> usually used for the testing purpose also.
Okay.
What's the difference between component, service, repository annotation? And can we use the service on repository and repository annotation on service files?
A component is a Sorry, component?
Okay, forget about component. Just tell me the difference between service and repository annotation, and also tell me whether can we use service annotation on repository files and repository annotations on service files.
Yes, we can both in the service annotation we use with the at the rate service at the rate service annotation, which is a stereotype annotation.
Component, service, and the repository all are the stereotype annotation. In the service in the service class, we work with the at the rate service, and in the to use for the business logic, we use that service class. And the repository we we work with the database operations.
With the with annotation of the repository which extends the JPA which perform the database operations in the application.
>> [clears throat] >> Okay.
Got it. Can you tell me what is Spring application context and how it is different from bean factory?
Uh If I'm not exactly recalling with the bean factory which is old the application as I'm recalling that we can get the whatever the bean required we we can we can get that as an application context CTX is equal to new annotation configuration application context with the CTX we get with the get bean method we give the bean method of it with the return type.
We fetch what beans we required in them.
Yep, yep, yep. Actually, bean factory is a basic Spring IOC container, lazy initializes beans on first request, minimal footprint. Whereas application context extends bean factory and adds eager singleton initialization and startup, event publishing, and a lot of things like AOP integration, resource loading, etc. Okay?
Okay, so Afan, can you please tell me the difference between request param annotation and path variable annotation?
Yeah, in the path variable annotation we go with the specific with the specific thing we go with the path variable ID. As example, we with the stations we are searching with station search station station ID.
Okay.
With the method name we used to provide we used to provide it. Station ID in the request param we fetch the data from the query params which give the dynamics value.
Basically, these two differences we have request param and the path param. Got it. How does a Spring validates a request body object?
What annotation would you use?
Sorry.
Okay, so let's say you have created one API and you have mentioned at the rate request body annotation there just to get the request body, right?
Now, you want to validate the fields of those request body.
>> Yep, yep.
>> At the rate valid we use we use as request whether it is a right request or wrong request. If it was right request, the process will go forward and if it won't then it will the not process the request further.
Okay.
And what are the validations annotations at field level?
At the field level we use the at the rate not null, not blank, at the rate size, positive, at the rate negative.
These are the field level annotations we use.
Okay, got it.
Um can you tell me um what is controller advice annotation and how do you use it for global exception?
In the global exception we used to handle the centralized all the exception at one place. We use the at the rate rest controller advice at the rate rest controller advice.
We create the custom exceptions first and we handle in the at the rate rest controller with the proper error responses. We set the data and the fields to get the response clearly to the client.
Got it.
Okay, moving ahead to um Can you tell me what is the difference between eager and lazy fetching in JPA?
And what are the defaults in our Spring data JPA?
Uh Spring in the Spring Boot by default it is a eager loading when it was coming to the loading. Uh suppose in the lazy loading we we are getting from the uh child entities along with the parent entities.
Parent entity as an example when user is calling with the orders order it getting along with that particular order ID. So, we used to manage the at the rate fetch type dot lazy or fetch type dot eager.
Okay, got it.
Um moving ahead, what is lazy initialization exception error?
Lazy initialization exception I'm not able to recall it now.
>> Okay. So, basically when no session occurs when you try to access a lazy loaded relationship after the JPA session has been closed.
Okay.
Okay, can you tell me the difference between save method and save and flush method?
Yes, both are the database operations in the while while if while the user is saving particular thing it directly directly directly don't change in the save method. Okay. In the save save and flush method whenever a user is changing something it instantly changes in the save save and flush but it degrade the performance in the save and flush.
Okay.
Got it.
Okay, so let's say you catch a generic exception in your code and log it.
Okay.
Okay, so I mean you just want to catch a generic exception and want to log it. So, how would you do it?
Generic exception as an example >> Through your REST API, let's say you want to catch a generic exception.
For example, runtime exception, null pointer, class cast, interrupted exceptions, these.
So, how would you do it?
We used to directly handle with the try and catch blocks inside the controllers.
Okay.
Yep, and also we could use the global exceptions, right? Global exception handling we mostly use with the global exception handling. Or we specific specific exceptions we create with the general exceptions and we used to present them.
Correct, correct.
Okay.
Um Do you know about singleton design pattern and what are the common issues with it and how would you implement it safely?
Yes, we have used in the singleton design pattern in our application. It is only one instance created for the container. Okay.
Okay. As an example, we have an in our project we have used the configuration with the railway config which used it to load the preload before starting the application zones, divisions, and the stations and we use that in the services by using the at the rate auto wide dependency injection so that we can use we can use in the services wherever we required.
Yep, yep. Okay.
Um How would you write a JUnit test case that a class depends on a singleton?
We have been not written any test cases here with the JUnit but we have been with the postman we have we have in a front end in the Angular.
We directly test with the Angular at that time.
Okay, so basically singleton make testing hard because you can't inject a mock.
The class reaches out directly, you know?
Yes, yes.
Okay.
And do you have any experience with builder pattern?
Yeah, I do have an experience with the builder pattern.
Please go ahead.
Whenever we are creating with the complex complex objects then we use the builder [clears throat] design pattern. As an example, we have the constructor overloaded so constructor overloaded in our project so that every time we are creating the different different objects for it. So, we used the custom custom builder pattern by using the at the rate builder.
At the rate builder we used to set at the rate builder for it.
Got it.
Uh Okay.
Moving ahead, can you tell me how does the open close principle apply to payment system that keeps adding new payment methods?
Uh I have not worked with the solid I have not prepared for the solid means Okay, you don't know the solid principles?
Yeah, I do know I do know the basics but I am not particularly in that uh Okay, okay.
Yeah, it's fine. Do you know open close principle?
Yeah, I already but I have not been uh in that >> Got it, got it. Are you using Git commands?
Yeah, we are using. Of which Git commands do you use most of the time?
Most of the time we use the Git commit, push, pull, stash for the temporary storage.
How do you resolve Git conflicts?
Whenever committing the same file with the two other developers then we get the Git conflict.
So, we used to edit there and see the code which the is appropriate code and we used to remove and we commit it.
Okay.
Have you used Git cherry pick?
Sorry. Git cherry pick.
No, I have not used. Okay. Have you used Git rebase?
No, I have not used. No, okay. Which one you are using for building project, Maven or Gradle?
We are using the Maven. Maven. What's the difference between Maven clean and Maven install?
Maven clean we use the for the cleaning the repositories cleaning the project which we are the injecting the dependencies in the class class path.
And uh Maven Install.
Uh Maven installing the reinstalling the packages whatever we are included in the dependencies in.
Okay. So, let's say you want to create a REST APIs, a simple CRUD application for I mean and you have to include the REST API.
So, what dependencies would you use in your palm?
Or add?
>> Uh we use the starter dependencies with the Spring Data JPA. Mhm. Uh which bring the dependencies of the Spring Data JPA we use it and uh Lombok annotation we use and for the other data no arc constructor all the data all all arc constructor for the Lombok annotations. Mhm. And uh we use the Yeah, data JPA Lombok annotations and uh my we use the MySQL So, why do we use Lombok?
We use the Lombok annotation for the no need to write the all times every time with the getter and the setter methods to reduce the boiler plate code.
Okay. So, uh do you know the servers that we have in our Spring Boot application?
Server? Servers.
Yeah, we have used the Tomcat servers.
Okay. So, what's the purpose of servers for our application? What Tomcat do?
We deploy the application for the deployment purpose we use the Tomcat.
Okay. Have you used Jetty?
No, we have not used any Jetty. Can we use in the future?
Yeah, maybe we use the in the future.
But uh How can we use? Like what would you do in order to use Jetty?
Uh I don't uh have the idea about the Jetty. We use the Tomcat mostly. Okay.
>> for the deployment of the What's the default port number?
8080 uh sorry, 8080.
>> want to change it to the different one?
Uh we used to present our application.properties we used to give the our custom number as 89090. So, which one do you like most application.properties or application.yml?
Uh we have used in our project application.properties, but application.yml is rightly we are using in the industries which is a indentation Okay. So, let's say if you have two files application.properties and application.yml, our application will pick which one?
The configuration I have not encountered this issue. Okay. Okay.
Got it. Have you encountered a circular dependency issue?
Yes, I have encountered the circular dependency issues. Okay. What was that?
>> is injecting into the another dependency. And how did you resolve that?
Uh by using the lazy annotation we have we use the lazy annotation. Correct.
Correct.
Okay. So, uh Shake, it's done for my end and yes, it was a very very nice interview.
関連おすすめ
Agentforce NOW AMA: Build with React and Salesforce Multi-Framework
SalesforceDevs
490 views•2026-05-28
How agent o11y differs from traditional o11y — Phil Hetzel, Braintrust
aiDotEngineer
450 views•2026-05-28
Re: 🗣️📍theprophedu📍2026 GST 103 CLASS (E-EXAM REVISION)
theprophedu
636 views•2026-06-04
WEB TECHNOLOGIES UNIT-2 | Degree 4th sem BCOM Computers web technologies unit-2 full explanation💯✅
LearnwithSahera
1K views•2026-05-29
More tests are always better? How to use AI to identify tests that bring little value
Alliance4Qualification
335 views•2026-05-29
Search Algorithms Explained in 60 Seconds! 🤖💨
samarthtuliofficial
218 views•2026-06-01
People of Game of Thrones using JavaScript DOM
AltCampus
296 views•2026-05-30
Instagram accounts got PWNed
EricParker
13K views•2026-06-03











