Try / Catch & Exceptions | Java | Tutorial 25

preview_player
Показать описание

Throughout the course we'll be looking at various topics including variables, arrays, getting user input, loops, conditionals, object orientation, and much more.
Рекомендации по теме
Комментарии
Автор

Dude, I honestly love all your tutorials! I was looking for some tutorials online and I was like boring... boring... boring... BINGO! I love this channel.

xxaviersanchezz-personal
Автор

Great job on explaining this. I am in my second semester of my software development program and I was working all day on my assignment in for my Java class. I am 35 and going back to school with no programming experience at all. Thanks to your video I got a way better understanding of this and it helped finish my assignment. I needed a few if statements but I got it covered! Thanks dude!

xxxxgxxxx
Автор

My constructive criticism:

Catching exceptions for the sake of catching them is not a good idea. You should classify exceptions in two groups: expected exceptions (one can expect that some users will provide a wrong input) and unexpected (you can't expect that an array will go out of boundaries, deep inside your code).
If the exception is expected, you should provide a path for the program to recover and keep working. Like asking the user for new input.
If the exception is unexpected, you should log it, probably let your program crash, and fix your code later. So that the exception is properly handled or no longer possible, after the fix.

For instance, if a bank transaction throws an unexpected exception, it's better to abort the transaction altogether, rather than giving away your money without sufficient guarantees. In fact, the exception may be due to a hacker who is tampering with your interface in order exploit bugs.

In general, the checked/unchecked labelling that Java provides for exceptions is a good start for your expected/unexpected classification. However, a wrong-input exception that may be expected (when the input is provided by a human) can come out of the blue when that same input is provided by a database (which is not supposed to make that kind of mistake).

EuroUser
Автор

Thanks Mike, this really helped me out despite programming for almost 5 years!

omarkhan
Автор

who the hell could dislike such an exceptional tut video? probably a competitor lol

jcperez
Автор

lmao. "You put in the wrong stuff. How dare you??" always great to learn AND laugh.Thanks :)

sarahy
Автор

Hi Mike, this is just mind blowing delivery!!!

humayunhimu
Автор

Thanks Mike! Could you please explain the difference between throw and throws and when we use them in a video?

shahrzadmaftoun
Автор

You deserve more money then my programming teacher.

ishansthakuri
Автор

This is a great supplement to the material that I am learning now. Thanks for making this video!

InSterquiliniisInvenitur
Автор

Thanks, I've been struggling to understand the concept of the try and catch exception.

octoii
Автор

You are the best, thank you so much for these videos.

Abby-fhhv
Автор

resume:
1) catching exceptions
2) can catch some speficic type of exceptions ( catch ( typeofexc e) ...)
3) errors are different from exceptions: are more bad than exceptions.
4) do not catch errors, not reccomended.

nicolahcm
Автор

Golas~monitor errors ~no eexecution and handle them

thealchemist
Автор

How can I input this Try/Catch in your last video named Building a Multiple Choive Quiz. I think it would fit perfectly there

aldreinmendiola
Автор

it's very nice example (try/catch )-kindly give some more example .and thank you again boss

programpioneer
Автор

I feel that this topic could get "real complex, real fast." Is it possible for us to add additional functionality after the "catch" criteria is met? I am sure there is an easy way to reset to the System.out.println("enter a number: "); part of the code after the try/catch has prevented the code from failing, I just wonder what that way is.

douglasbelton
Автор

S:get a number from user
E:whats went wrong /class in java /data type ~store

Antigashlighting
Автор

How about an exception if you input number instead of a letter? is there any?

Nbak-cwjx
Автор

How to use TRY/CATCH inside a nested FOR loop so it wouldn't stop the program or print out nonsense?

fzdz