Exception handling Interview Questions and Answers in Java | Code Decode | Live Demo | Part 2
Experienced and Freshers both candidate can refer this video of Code Decode Exception handling Interview Questions and Answers
Udemy Course of Code Decode on Microservice k8s AWS CICD link:
openinapp.co/u...
Course Description Video :
yt.openinapp.c...
Exceptional Handling Part -1 : • Exception Handling Int...
This video covers exception handling frequently asked interviews and answers with Live code demos . It covers Chained exceptions, exception propagation such concepts.
Lets understand this with an example. Where the normal flow of your java application goes like this. You send a http request for a resource to controller.
Controller handles it and send to Service where business logic is written which in turn gives inputs to DAO layer If database interaction is needed. Then finally data is Added or fetched to or from data base back to Same flow from DB to DAO to Service/ business layer to controller which sends response to UI and u get the data form the DB or update the data in DB.
Now Consider a situation where Database exception occurs and u need to tell this to user. You can see multiple layer in between. How to preserve the original exception when it propagates across multiple logical layers in a program?
Answer is through Exception Chaining.
Here Database throws SQLException. Which is caught by DAO class.
DAO class throws DAOException which is caught by Catch block in Service class.
Service class throws the catched DAO exception as ServiceException which in turn is caught by controller .
Controller will now handle it appropriately and send the user friendly message to UI to be shown.
The printed exception stack trace reveals an exception propagates from the SQL / DB layer up to the Controller layer.
This is called exception propagation which helps in debugging process.
Chained Exceptions allows to relate one exception with another exception, i.e one exception describes cause of another exception.
Methods Of Throwable class Which support chained exceptions in java :
getCause() method :- This method returns actual cause of an exception
initCause(Throwable cause) method :- This method sets the cause for the calling exception.
The initCause() method of Throwable class is used to initialize the cause of the this Throwable with the specified cause passed as a parameter to initCause(). Actually, the cause is the throwable that caused this throwable Object to get thrown when an exception occurs. This method can be called only once. Generally, This method is called from within the constructor, or immediately after creating the throwable.
Chained exception helps during exception handling. you get the real cause of exception
Most Asked Core Java Interview Questions and Answers : • Core Java frequently a...
Advance Java Interview Questions and Answers : • Advance Java Interview...
Java 8 Interview Questions and Answers : • Java 8 Interview Quest...
Hibernate Interview Questions and Answers : • Hibernate Interview Qu...
Spring Boot Interview Questions and Answers : • Advance Java Interview...
Angular Playlist : • Angular Course Introdu...
SQL Playlist : • SQL Interview Question...
GIT : • GIT
Subscriber and Follow Code Decode
Subscriber Code Decode : www.youtube.co...
LinkedIn : / codedecodeyoutube
Instagram : / codedecode25
#codedecode #exceptionhandling #javainterviewquestions
Пікірлер: 61
You are just savior for the developers like me who sticks to a company for a long time only because of not having regular touch with techinical skills. Mam, you are just awesome in explaining things more crisp and clearer. You must deserve more and more subscribers and I just want you to thank in person as I watched most of your videos day and night that helps me to crack interviews in reputed organizations like harman etc. Really loved your work to the core and no thank you will pay the value for your amazing work. WE ARE HERE TO SUPPORT YOU 🙌 KEEP GOING MAM🤩
@CodeDecode
2 жыл бұрын
This means a lot to us Pradeep. Thanks a tonnn for supporting us. We can't be more grateful to have you in our code decode family. :)
Ever since I started watching your videos, I have been recommending it to anyone who is in the process of job search. Love the way you keep things to the point and technical enough for anyone to easily understand and follow... Please continue the good work and help many more like me to find new jobs. Thanks again 💐
@CodeDecode
2 жыл бұрын
Thanks a lot Yogesh. This comment made my day. 🙂👍. All hard works seems worth it after this. 🙂 so glad to see you landed at your dream job. Keep learning keep shining Man⭐✨⭐✨⭐✨👏
Yes!! Please create more videos on spring and hibernate. Good knowledge sharing video.
@CodeDecode
2 жыл бұрын
Sure akash we will do that
Please make 3rd part of this exception handling series. We are waiting for 3rd part. These videos are very helpful for all the java developers. Thanks😊
@CodeDecode
11 ай бұрын
Sure 😊
Great videos, I have been suggesting my friends to go through your videos for easy understanding . So please create sequence :)
@CodeDecode
2 жыл бұрын
Thanks A lot Shruthi 🙂👍
Sure please upload more of videos on exception handling... It wld be really helpful
@CodeDecode
2 жыл бұрын
Sure Priyanka 🙂👍
Thanks team.
Thanks 👍. Please continue videos on the topic
@CodeDecode
2 жыл бұрын
Sure sourabh we will create more videos on this
Please create video on different cases of parent and derived class method behaviour when either is throwing exception and if we can increase or reduce exception
I just want to know from where this energy to you ma'am 🙏 really great way of explaining things 😊
@CodeDecode
6 ай бұрын
Thanks Seema 😊
Please please please create more videos on advance questions of exception handling . Please I have been referring to my friends to watch and like who ever is working in java or searching a job in java
Hi madam can you please create an video how anonymous inner class is used while using lamda expression like when we use lamda what happens internally?
I am trying to insert audit log of the exception in catch block when exception occur in try block but it is not inserting into db and it is giving Nosuchelement exception from catch block
Why there is no throws clause in method signature in service when you throw an exception?
@CodeDecode
11 ай бұрын
Bcz you are able to handle it then and there with try and catch block
Mam please cover all other sections of exception handling also. We are eagerly waiting for it.... Thank you in advance 🙂
Great video. Please create customized exception video
Mam make more such videos for exception handling like try with resource, custom exception
ma'am pls make exception handling questions for fresher interviews
@CodeDecode
2 жыл бұрын
Sure Ilyas 🙂👍
Please make another video to cover the more topics.
@CodeDecode
Жыл бұрын
Sure we will create it soon
Please upload more of videos on exception handling
@CodeDecode
2 жыл бұрын
Sure Pooja 👍🙂
Do we have Exception Handling part 3 video
Please create more videos in order to cover whole exception handling section .
@CodeDecode
2 жыл бұрын
Sure Mudit 🙂👍
Ma'am, please....make a video on how to use hashmap, hashset(implementation of collection) in springboot project.
Thanks
@CodeDecode
2 жыл бұрын
🙂👍
thanks
@CodeDecode
2 жыл бұрын
🙂🙂
Tq
@CodeDecode
2 жыл бұрын
👍👍🙂🙂
Can you cover the topics like docker,kubernets,unittesting, AWS any topic
@CodeDecode
2 жыл бұрын
Yes we will 🙂👍
Please make more viodeos on exception handling..
@CodeDecode
Жыл бұрын
sure mrinal we will upload more videos on exception handling
do more videos on this
@CodeDecode
2 жыл бұрын
Sure
Where we can find other questions related to this topic ?
ma'am pls make interview quesns on multithreading
Where do you have to go?? Why that fast?? Awesome content but plz take care of speed.
every video is sooo good, but i felt this is kinda fast
at time 11:00 mins your very fast can you bit slower in this case
@CodeDecode
2 жыл бұрын
Ok sure
Too fast.... I would suggest you to go slow we are not able to get the things so quickly.
@CodeDecode
Жыл бұрын
Sure Vishal 👍
@vishaldhamde2013
Жыл бұрын
@@CodeDecode I appreciate that you are responding to each & every comment and I must appreciate the content that you are picking and explaining everything in detail through this channel. Interested to see more videos. Thank you!
@CodeDecode
Жыл бұрын
Thanks Vishal. Your suggestions helps us grow. Much appreciated 🙏🙏🙂🙂👍
hi mam i have doubt can u give contact
@CodeDecode
Жыл бұрын
Sure please mail at codedecodebusiness@gmail.com link is given in channel description too