Thanks to Mailgun for sponsoring this video! Head to mailgun.com/john to try Mailgun free today. If you have any questions, be sure to ask here!
@DaxterSnickers2 жыл бұрын
Nice, you actually did a video for what i asked for. Youre the best, thank you!
@turuus52152 жыл бұрын
I'm reading "Java All in One for Dummies," and I had trouble wrapping my head around the "throwing exceptions" chapter. Thank you for clearing up my confusion. Your lessons are intuitive and straight to the point. Your delivery is amazing.
@libertymedicalcommunicatio49082 жыл бұрын
We’ll done. You’re a natural teacher!
@edgardom.74552 жыл бұрын
Hi John, I recently discovered your channel, and I loved the way you expose the content. Learning to program when you are close to 50 years of age, is a much more affordable challenge with the help of channels like yours, thank you very much for your time and dedication. Greetings from Chile.
@ravireddyism2 жыл бұрын
I appreciate your courage coz guys in 20's are finding hard to understand Java but you in your 50's have accepted this challenge to learn java at your age. I wish you all the best and I hope with your dedication and interest you will master it.
@blubbfisch9811 ай бұрын
After going through several videos, this is the first truly informational one. No weird jumps, well-spoken English and not a lot of noise around the main topic. I know this video is old by now - but keep it up! :P
@Adrastus_2 жыл бұрын
thanks john. I've been watching more and more of your videos as a java beginner, and as I watch them, each one makes me more certain to get your java bootcamp. these videos are truly great and if im going to learn even more, it will be immensely helpful to know the fundamentals are coming from you.
@Achraf_01016 ай бұрын
i have already registered in his bootcamp but there is no problem solving exercices right there we can only watch tutoriels
@lefruitcake Жыл бұрын
if you hadn't explained the extends RuntimeException part, wouldn't have saved me in a pinch! Thank you so much!
@mustapharaimilawal8053 Жыл бұрын
Hello John, thanks a lot for this video. I watched it some months ago and I missed some points you made about passing Throwable into the custom exception constructor but watching it again now made me realized how detailed this video is. Thanks a lot.
@fcbarcatv-ou4ww Жыл бұрын
ive been watching many of your video for the past 3 hours, youre an actual legend
@fatmamohmed58 Жыл бұрын
Before this video i was suffering with Exception but now i find it so easy thank you for your effort
@hummerzone2 жыл бұрын
i love your simple but clear explanations,,thanks John
@paranormaledits95262 жыл бұрын
Watching this before exam, you're a great teacher.
@aniolmalin Жыл бұрын
that runtime stuffe just solved me a task i thought is difficult, thanks
@KishoreN-p8s9 ай бұрын
Brilliant teaching, every word you spoke in this video had intense meaning to it, Thank you
@ohmohm78848 ай бұрын
Simple, informative, and clear. Brilliant. Thank you!
@diegoi1313 Жыл бұрын
Thank you for this well informed video. I was able to complete my assignment after watching it.
@vn75123 ай бұрын
Your Video always pop up whenever I needed the most! Thank you
@ravikumarray3382 жыл бұрын
We should neither extend Throwable and nor use it in Catch block. Reason why not to use Throwable in catch block is that it will catch Error also which is not desired .
@familyshare37242 жыл бұрын
And thus passing Error to custom exception constructor should fail to compile. In other words: Exception cause, not Throwable cause.
@boxacuva2 жыл бұрын
I Agree there is really no need to extend Throwable.
@hunelysium9 ай бұрын
Thank you for making all wonderful videos on Java!! All of them very clarifying!
@prasadgujar20072 жыл бұрын
I purchased your course, however, now i realized you have more detail knowledge on youtube
@sabei221b Жыл бұрын
I'm obsessed with your content, amazing job!!
@samreensaleemudeen12202 жыл бұрын
love the way you've explained this concept... I didn't learn this properly in C++ so ... I'm really happy that I could understand it so quickly... thank you so for that 😊
@Abhijeet_Tripathi_2 жыл бұрын
Struggled with this topic for so long..... You're an amazing teacher 🙌🏻🙌🏻🙇♂️.... Thank you so much🙏🏻
@enfieldli92962 жыл бұрын
Wow, cleared some of my confusions, good stuff! Thank you so much John!
@Righteous_Companions2 жыл бұрын
Thanks sir 😊 That was helpful 🙂 I was having trouble making custom exception, Thanks to this video finally its done
@CodingWithJohn2 жыл бұрын
Not so hard once you know!
@erezswickley2139 Жыл бұрын
Amazing. You really helped me wrap my head around this concept. Thank you so much, I really appreciate it.
@jaredschwery1672 жыл бұрын
Thanks John! Helpful as always :)
@SaiNadhBolloju2 жыл бұрын
Thanks for your efforts in here… making complex things simple to understand. A request, please explain time and space complexities in your terms.
@nudaykiran20142 жыл бұрын
Simple and clear explanation
@yasminaitmaksene5230 Жыл бұрын
What a simple way to explain things ! Thank's a lot. 😁😁
@abdulrashidsinancu163010 ай бұрын
How to know if an exception is checked (Compile Time ) or Unchecked (Run Time) Ans: If a class extends Exception ->It is known as Compile Time or Checked Exception If a class extends RuntimeException ->It is known as RunTime or Unchecked Exception
@SayanRick1002 жыл бұрын
Thanks man.... I'm watching your video from India... it's really helpful
@Learn_IT_with_Azizul Жыл бұрын
useful content... but I don't like ads, and thanks for time stamps
@AnnaAdamczyk2 жыл бұрын
Thank you for another easy to understand video!
@ayushkumar-cl7co2 жыл бұрын
Watched all videos...ur teaching style is awesome.....plz bring videos on Spring Boot
@piyushash2 жыл бұрын
Yes, absolutely i am also waiting for Spring boot playlists
@mikelkumar66802 жыл бұрын
Thanks for your work
@ErenYagdran2 жыл бұрын
I'm so fortunate to see a java developer hailing from the last ice age :)
@lakshyasaharan53482 жыл бұрын
Looking forward to your hair sponsorship.
@matiasmoresi50402 жыл бұрын
Hey John! Loving all your videos! Could you do a tutorial on Streams? 🤩 Thank you so much!
@boxacuva2 жыл бұрын
I think Streams are a little bit more complex than exception Handling. At least in Theory. But i would recommend u to write all existing Stream Classes down (Sub/Base Classes, Decorators, Reader/Writers,...) and put them in Relation.
@sudharshan32nft Жыл бұрын
Thanks John
@Speiger2 жыл бұрын
I found that mojang used exceptions very weirdly. If a network packet is in the wrong thread, they append it in a thread and basically throw a exception that does no logging to stop processing of said network packet. (Ignoring the implication on how bad it is to throw hundreds of exception per second, it is still a really interesting concept)
@VictorHernandez-qt2xx2 жыл бұрын
Great content. Please add the benefits of catching it in your catch block. Also point out that extending from IllegalArgumentException changes the custom to a runtime excpetion.
@thelinkguys29252 жыл бұрын
Wish you have a full spring boot course!
@ayushchakraborty19212 жыл бұрын
Easy to understand! Will remember the *don'ts* 😂👍🏻
@pipocosounds Жыл бұрын
Your channel is gold wow!
@pranavkarpe97422 жыл бұрын
Can you make a video on collection framework. Loved the way you explain the concept.
@jovictor30072 жыл бұрын
Thanks, I thought exceptions were some magic, I didnt realise they were just classes.
@CodingWithJohn2 жыл бұрын
Yeah I know what you mean, it feels like such a mystery until you learn that.
@blasm17132 жыл бұрын
john john john, your videos are inspiring
@chetanraj1950 Жыл бұрын
Thnak You for this lecture.
@fabricio.entringer2 жыл бұрын
Good video. Direct and amazing!
@nikhilagrawal921710 ай бұрын
Really helpful. Thank you sir.
@mohannadarslan2478 Жыл бұрын
Thank you
@xxxguruji5211 Жыл бұрын
Thank you .
@Another0neTime2 жыл бұрын
Great explanation.
@olillin2 жыл бұрын
Thank you!
@Pacvalham2 жыл бұрын
throw new NullPointerException(); //shortcut for throwing a null pointer exception: throw null;
@CGDW22 жыл бұрын
But at which point is it worth it to actually create your own custom Exception rather than just using (going by this example) IllegalArgumentException with a message that says something like "age must be positive". Would one ever put additional functionality in a custom Exception? Aside from the comedic value of hilariously named exceptions that your co-workers would hopefully run into (itWasYourJobToImplementThisException), why bother?
@stephenJpollei2 жыл бұрын
It is probably worth creating your own custom Exception when you can have actual value in using that type in a "catch". Maybe an example of potentially good "additional functionality" could be extra fields that store information that "catch" block could use. Like a MessageNotReceivedException could take a reference to the message so that the catch block can requeue it.
@CGDW22 жыл бұрын
@@stephenJpollei Ah right, I can see how that would be useful.
@familyshare37242 жыл бұрын
In many backend projects (say microservices with many inputs and outputs), I distinguish between client validation exceptions (invalid external input), upstream exceptions (like database failure), retryable exceptions and non-retryable exceptions. I then want every transaction to have exactly one and only one final status: happy (info) or one fatal exception (log error) type. No matter the service type, it's similar to HTTP or FTP response codes: 200 ok, 404 not found, different 4** client errors, and 5** (this service failed) or upstream/gateway temporary or unrecoverable failure.
@familyshare37242 жыл бұрын
Many projects decide whether to handle checked or unchecked exceptions exclusively on day one. Checked Exceptions should be handled immediately by the caller. If a project team (for whatever reason, including lack of discipline) won't consistently handle checked exceptions, then IMO the team should decide to wrap (all) checked exceptions as unchecked (either as a rethrown RuntimeException cause or custom exception extending some runtime exception). I recommend a strict consistent pattern, rather than developer whim ("hey this existing exception sounds kinda like it fits our problem"). If you're not sure, then wrap all exceptions as RuntimeException (or a single common custom exception) until you refactor later when/if you do know what you want.
@familyshare37242 жыл бұрын
Maybe it's worth noting that many, including architects at Sun, considered the combination of checked and unchecked exceptions a compromise and regrettable failed experiment. Checked exceptions help write reliable fail-proof code. But if not properly understood, not properly handled, checked exceptions often lead to terrible programming habits (like catch and ignore at worst to catch and rethrow at uh, typical annoying tedium). The Throwable, Error, Exception, RuntimeException inheritance structure is a (necessary?) bastardization that also encourages (allows for) poor coding practice (exception mis-handling).
@ruralthunder88542 жыл бұрын
Have you ever considered making videos on data structures in Java? Thanks for the videos!
@johngeorge92967 ай бұрын
hey john this tutorial was so informative within a short duration you have covered many important topics! do you offer J2EE and spring related course? besides highfive to you that we have same name....
@s60314172 жыл бұрын
YES
@Eva-kt3tu10 ай бұрын
thank you so much
@enzokuhlemsotra63836 ай бұрын
Mr John what do i need to become a software engineer just like you? meaning after learning java or any other language what are other things that i need to learn in other to become a software engineer.
@LTZMSYAL2 жыл бұрын
Hi John! Thank's for your great tutos. Could you make a video on the binary search algorithm? Think it would be helpful. Thank's :)
@purenepalikancha4 ай бұрын
Hi John, I have a quick question. Is it correct that if we use an unchecked exception, it is better to surround the exception block with try-catch instead of using throws in the method signature? However, if it is a checked exception, then it is better to use throws in the method's signature.
@familyshare37242 жыл бұрын
Constructor takes Throwable or Exception cause?
@ivankobyuk83852 жыл бұрын
From Ukrainian dev with huge appreciation! / Від українського розробника з вдячністю!
@timm13282 жыл бұрын
Extending Exception is usually a bad idea. Checked exceptions were a failed experiment and only leads to empty global catch clauses strewn through the code. Instead custom exceptions can extend RuntimeException. Furthermore throws clauses on methods are a pain in the ass when trying to pass method references.
@slimandahra42942 жыл бұрын
I will find out..i have eyes 👀 everywhere That's funny 😂 Well done
@abhineveash9 ай бұрын
Finally got it🎉
@vicke9092 жыл бұрын
Hi, can you do a javaFX tutorial or perhaps a short video showing how to begin? Thank you : )
@socaljusticewarrior5582 жыл бұрын
I like the part where you point at the camera and go out of focus and then come back. That was very cinematic.
@CodingWithJohn2 жыл бұрын
Yep, new camera! Besides that part, it's pretty hard to tell the difference between this and all my other videos which were just recorded with a phone.
@DeepakSharma-mi8nz Жыл бұрын
Hey John you are awesome
@ipodtouch4702 жыл бұрын
Could you show exception handling in possibly a larger code base? I understand the concepts but fail to put them into the big picture. For example why use an exception at all instead of an if statement since the possibility of getting a negative age is common .
@JorgetePanete2 жыл бұрын
Take for example a method that returns a number that is either valid or broken, how do you check that assuming you don't know what the method does? The method could have instead a BrokenNumberGeneratorException in the method and you could catch it
@developer90499 ай бұрын
Thanks :)
@Y3llowMustang2 жыл бұрын
What VS Code theme is he using?
@CodingWithJohn2 жыл бұрын
This is IntelliJ, with the standard theme. The only change is I darkened the background a little.
@sidforreal2 жыл бұрын
Good to see you finally ditched eclipse 😛😛
@KolomiecSergeyK2 жыл бұрын
Hello, thanks for a nice video. One point that I want to understand, do you think that validation should be handled by exception? As far as I know exception is quite heavy for JVM. Maybe better just return true or false in case something valid or not.
@JorgetePanete2 жыл бұрын
exceptions (throwing and not throwing) have gotten lighter at least
@HanWae3632 жыл бұрын
If you dont extend exception wouldn't a try catch block also not work if it were trying to catch all Exceptions? Since most exceptions inherit from a root parent Exception?
@kamal-xd7id Жыл бұрын
By creating so many custom exceptions, wouldn't it be so unmanageable? Rather we use or define a little more generic or superclass of specific exceptions and pass in the details as param?
@MehrzweckMandala4 ай бұрын
Thanks for the video. I'm just wondering: My instructor said regarding "error messages" => Especially with exceptions: Issue clear error messages! Cryptic Java messages about what is wrong where and how in the code are of no interest to the actual user of the program. How do you feel about this?
@keydiram2 жыл бұрын
Hi, Can you add a Maven tutorial? Thanks.
@MariusSipanu Жыл бұрын
Very good video
@javalady6 ай бұрын
Thanks that was really usefull
@DadaKhan19122 жыл бұрын
Sir, How can we print the custom exception in catch block like e.printStackTrace() or sout(e);
@CodingWithJohn2 жыл бұрын
Depends on what you would like to print. sout(e) doesn't give you very much (I haven't tried it until just now, but looks like it just prints the class name of the exception). e.printStackTrace is often useful for debugging (although logging tools handle printing the stack trace for an exception their own way in larger applications), so that is more likely what you want. You can also print out the message on your exception if there is one, which you can find at myException.getMessage();
@DadaKhan19122 жыл бұрын
@@CodingWithJohn Thank you sir for replying for my message with a good explanation 😊
@larryd95772 жыл бұрын
NegativeAgeException.
@CodingWithJohn2 жыл бұрын
Even better!
@luwamabraham4338 Жыл бұрын
I don't now how to thank you. GBU
@kezug Жыл бұрын
Is there an inherent overhead (performance degradation of the app) when using Exceptions and Custom Exception handling for "business" error handling as opposed to just putting in validations in code without exception handling? (Assume a large application with many business rules and just trying to come to terms with making a decision of when to use custom Exceptions for business validations vs never)
@Cemtexify17 күн бұрын
I'm trying to do unit tests of my project that has a custom exception class and it gives me an error that it triggers the custom exception (I want it to, that's the point of the test).
@berkcanulubas13187 ай бұрын
thank you for th great videos
@blacksheep13372 жыл бұрын
nice u a real goood teacher
@joelpww2 жыл бұрын
God sent
@rasZam Жыл бұрын
why did our custom exception extend Exception? why not RuntimeException?
@samuelbullon3792 Жыл бұрын
loved it
@Sudheer_6622 жыл бұрын
hi john ,can u pls make a video on java Streams api
@LeafyConversations Жыл бұрын
You are awesome!!!!!
@holdendewit7088 Жыл бұрын
Wouldnt using super in the constructor invoke the constructor of the super class (that is to say effectively you have AgeLessThanZeroException e = new InvalidArgumentException(mes, cause); )? If thats the case is there any real benefit to making local object variables and methods instead?
@yasminaitmaksene5230 Жыл бұрын
Hello John I have a problem trying to use my custom exceptions. In some places of my method , when I try to throw a new custom exception, I'm getting this error : Unhandled exception type myCustomException. Eclipse suggest to add a try catch block to it. Any idea why I'm getting this ? Thank's
@CodingWithJohn Жыл бұрын
Any exception you make (unless it's extending RuntimeException) is what's called a checked exception in Java. That means it either had to be declared in the method signature that it can be thrown, or handled with a try/catch. Check out my video on checked and unchecked exceptions to learn more! kzbin.info/www/bejne/mHSzdJ-vfNiJnsU
@amirulidzham2 жыл бұрын
Hi John. Thank you for such a great video. Really appreciate it. I just have one question, sorry that it's not related to video, is there any way to have a dynamic set attribute in OOP? I'm kinda interested like what offered in Laravel's Eloquent method (the insert method). All you need to do is create new object, set attribute object from instance, call save method. Not sure if Spring has something to like this to offer.
@paveljavorek20762 жыл бұрын
Hi Not sure if is this the answer you looking for, but spring boot contains Spring Data JPA, when you can save atribute or objects to the database throught repository object
@amirulidzham2 жыл бұрын
@@paveljavorek2076 wow. I gotta try it out myself. Thanks for the valuable information.
@boxacuva2 жыл бұрын
This Question is a little bit confusing. Do you mean an ORMapper like EF/NHibernate or do you mean aop? Or Simply dynamic Keyword like in c#.
@amirulidzham2 жыл бұрын
@@boxacuva I've no idea of what are you talking. It not confusing at all. Maybe you should take a look at Laravel first specifically at eloquent method of saving data
@boxacuva2 жыл бұрын
@@amirulidzham wdym its just a normal ORMapper Feature. Maybe it would help to explain what that feature does instead of letting ppl looking it up for you. So they can help. I just gonna assume its a normal CRUD transaction done in a higher level langugage. Edit: Just googled it and found a php ORMapper. Not sure if that is what u asking for. So gl
@masudulalam25152 жыл бұрын
How do you handle filter level exceptions which are thrown from filter and can't be caught in @RestControllerAdvice/@ControllerAdvice annotated class?