No video

Checked Vs unchecked Exceptions with example in Java Interview Questions and Answers | Code Decode

  Рет қаралды 31,186

Code Decode

Code Decode

Жыл бұрын

Difference between checked and unchecked exception is very commonly asked java interview questions in every interview
Udemy Course of Code Decode on Microservice k8s AWS CICD link:
openinapp.co/u...
Course Description Video :
yt.openinapp.c...
Difference between checked vs unchecked exceptions
Checked
Unchecked Exceptions
Another name
Checked exceptions are checked by the Java compiler so they are called compile time exceptions.
Unchecked exceptions are not checked by the compiler. These are called runtime exceptions.
When
Checked exceptions occur at compile time.
Unchecked exceptions occur at runtime.
Handled by
These types of exceptions can be handled at the time of compilation.
These types of exceptions cannot be catched or handled at the time of compilation, because they get generated by the mistakes in the program.
Handling
Must be handled in a try-and-catch block, or be thrown by the invoking method
Exception handling semantics are not required
Difference between checked vs unchecked exceptions
Checked
Unchecked Exceptions
Force
Java compiler forces us to handle these exceptions in some manner
A method is not forced by the compiler to declare the unchecked exceptions into the method declaration.
Hierarchy
They are all subclasses of Exception.
They are all subclasses of RuntimeException.
Scenario
Checked Exception represent scenario with higher failure rate
UnChecked Exception are mostly programming mistakes.
Throws clause
The throws clause on a method header must be included for checked exceptions that are not caught and handled in the method.
The throws clause on a method header is not mandatory
Checked
Unchecked Exceptions
Examples
File Not Found Exception
No Such Field Exception
Interrupted Exception
No Such Method Exception
Class Not Found Exception
No Such Element Exception
Undeclared Throwable Exception
Empty Stack Exception
Arithmetic Exception
Null Pointer Exception
Array Index Out of Bounds 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
#exceptions #java #codedecode

Пікірлер: 26
@Aniruddhdwivedi
@Aniruddhdwivedi Жыл бұрын
Correct me if I am wrong - All exceptions occur at runtime. The only difference is Java compiler checks probable places in code for checked exceptions and forces developers to handle them.
@CodeDecode
@CodeDecode Жыл бұрын
Correct. Just that we can say they both occur during exception of code. Compile time - conversation of. Java to. Class ( saved in target folder) and. Class to exe is run time. But be very careful while answering this question as this is so much debatable question and trust me most of the interviewers just see what's written on internet and judge you on that. Our suggestion " be diplomatic on this debatable question " 👍👍
@SaeedAhmed-gl3xn
@SaeedAhmed-gl3xn Жыл бұрын
All Exceptions are handled at run time. It is not very much correct to say compile time Exceptions. Instead checked Exceptions are those which occur at run time only but compiler checks if it is handled by the developer or not. Checking is done at compile time for checked exceptions but occurring of Exceptions are always run time only.
@CodeDecode
@CodeDecode Жыл бұрын
Can you please suggest us some good reliable source of this information. It will be a great help for all of us n our subscribers Saeed 🙏👍👍🙂🙂
@CodeDecode
@CodeDecode Жыл бұрын
What we found in blogs n papers is : Just that we can say they both occur during excution of code. Compile time - conversation of. Java to. Class ( saved in target folder) and. Class to exe is run time.
@shobhitmittal77
@shobhitmittal77 Жыл бұрын
@@CodeDecode Here it is - kzfaq.info/get/bejne/jMVhfKiplpu1nXk.html&ab_channel=DURGAEDUCATION
@user-pt5ue6ep9y
@user-pt5ue6ep9y 10 ай бұрын
Super explanation. Thank you so much
@CodeDecode
@CodeDecode 9 ай бұрын
You are welcome
@Jamie-jz2ti
@Jamie-jz2ti 2 ай бұрын
Thank you Mam 🙏
@CodeDecode
@CodeDecode 2 ай бұрын
Most welcome 😊
@ShivaniDiware
@ShivaniDiware Жыл бұрын
Hi Code Decode , I really appreciate your efforts & your content is helping me a lot during interviews recently I have get some interesting questions if possible can you cover those as well? 1.characteristics of rest web services 2.what is Richardson Maturity Model?
@CodeDecode
@CodeDecode Жыл бұрын
Hey Shivani. Thanks Girl 🥰. Sure we will cover them but which company asked these Richard types questions😒. Sad to see such questions😐
@ShivaniDiware
@ShivaniDiware Жыл бұрын
@@CodeDecode its asked during internal client interview for American Express
@soulfulGirl_
@soulfulGirl_ Жыл бұрын
This Richardson Maturity was asked in epam for me as well ... And can you please made some videos on transaction roll backs please , do we need to roll back only checked exception in transaction?
@CodeDecode
@CodeDecode Жыл бұрын
We have it Harshini . kzfaq.info/sun/PLyHJZXNdCXsdPNwIReIMeC_Cr23Szi5tR Please do check this
@CodeDecode
@CodeDecode Жыл бұрын
Sure Shivani we will create video on this👍. We didn't know it's been asked intensively 👍👍 thanks Girl 🥰
@iron-man-507
@iron-man-507 Жыл бұрын
very helpful video ...thanks
@CodeDecode
@CodeDecode Жыл бұрын
🙂🙂
@sambayeti1525
@sambayeti1525 Жыл бұрын
Could u please make videos on executor and fork and join framework concepts in multithreading...
@CodeDecode
@CodeDecode Жыл бұрын
Sure 👍👍🙂🙂
@yourvoices
@yourvoices Жыл бұрын
Mam please tell me can we create both type of exception in java?
@CodeDecode
@CodeDecode Жыл бұрын
Yeah you can sandeep
@yourvoices
@yourvoices Жыл бұрын
​@@CodeDecodebut how can you explain me mam.?
@nikitasarda7389
@nikitasarda7389 11 ай бұрын
Hi, first of all thank you so much! Can we get notes for all the videos?
@rishiraj2548
@rishiraj2548 Жыл бұрын
🙏👍👍💯💯
@CodeDecode
@CodeDecode Жыл бұрын
Thanks 🙂🙂
Бутылка Air Up обмани мозг вкусом
01:00
Костя Павлов
Рет қаралды 2,2 МЛН
Kids' Guide to Fire Safety: Essential Lessons #shorts
00:34
Fabiosa Animated
Рет қаралды 13 МЛН
12. Infosys Interview | Java8, Stream APIs coding Question Answers
5:04
Top 30 JAVA Interview Questions and Answers for Beginners
1:25:45
Interview Happy
Рет қаралды 14 М.
Java Custom Exceptions Tutorial - It's Way Easier Than You Think
14:29
Coding with John
Рет қаралды 153 М.
Java Exceptions - Learn Exceptions in Java #43
11:07
Alex Lee
Рет қаралды 226 М.
Бутылка Air Up обмани мозг вкусом
01:00
Костя Павлов
Рет қаралды 2,2 МЛН