Try / Catch & Exceptions | Java | Tutorial 25

  Рет қаралды 55,467

Giraffe Academy

Giraffe Academy

Күн бұрын

Пікірлер: 49
@xxxxg1xxxx
@xxxxg1xxxx Жыл бұрын
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!
@xxaviersanchezz-personal
@xxaviersanchezz-personal 6 жыл бұрын
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.
@gunnarkennedy3292
@gunnarkennedy3292 5 жыл бұрын
boring boring maybe no boring possible BINGO bro your clown
@dartpit
@dartpit 5 жыл бұрын
@@gunnarkennedy3292 hes bare funny what do u mean??
@chrisschneider4226
@chrisschneider4226 Жыл бұрын
I agree, I love this channel.
@yankswap
@yankswap 2 ай бұрын
5 years ago… how’s your coding journey going since then?
@omarkhan5223
@omarkhan5223 4 жыл бұрын
Thanks Mike, this really helped me out despite programming for almost 5 years!
@jcperez7925
@jcperez7925 5 жыл бұрын
who the hell could dislike such an exceptional tut video? probably a competitor lol
@EuroUser1
@EuroUser1 5 жыл бұрын
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).
@yankswap
@yankswap 2 ай бұрын
In your example of telling the user it was the wrong input and asking for a valid input, what if they then entered the wrong input again? Should you catch and throw another Exception? How far down the rabbit hole does it go? Or is there a better way where you can prompt the user to keep entering inputs until a valid one is entered?
@EuroUser1
@EuroUser1 2 ай бұрын
@@yankswap There is a way to keep the user inside a loop, until a valid input is entered. But I can't remember the syntax details. I wrote the original comment more than five years ago, and I stopped programming shortly after. I found a different job that suited my needs better. So I have forgotten much of my Java, now.
@sarahy5991
@sarahy5991 3 жыл бұрын
lmao. "You put in the wrong stuff. How dare you??" always great to learn AND laugh.Thanks :)
@humayunhimu6045
@humayunhimu6045 2 жыл бұрын
Hi Mike, this is just mind blowing delivery!!!
@InSterquiliniisInvenitur
@InSterquiliniisInvenitur 4 жыл бұрын
This is a great supplement to the material that I am learning now. Thanks for making this video!
@ishansthakuri
@ishansthakuri 3 жыл бұрын
You deserve more money then my programming teacher.
@Abby-fh7hv
@Abby-fh7hv 3 жыл бұрын
You are the best, thank you so much for these videos.
@shahrzadmaftoun5831
@shahrzadmaftoun5831 3 жыл бұрын
Thanks Mike! Could you please explain the difference between throw and throws and when we use them in a video?
@shantanu925
@shantanu925 4 жыл бұрын
I just can't thank you enough!
@ousmandibbasey8933
@ousmandibbasey8933 2 жыл бұрын
very good lecture
@octoii2418
@octoii2418 2 жыл бұрын
Thanks, I've been struggling to understand the concept of the try and catch exception.
@RealNaps
@RealNaps 6 жыл бұрын
Mastering java
@programpioneer9303
@programpioneer9303 4 жыл бұрын
it's very nice example (try/catch )-kindly give some more example .and thank you again boss
@إسماعيل-ط6خ3ض
@إسماعيل-ط6خ3ض 3 жыл бұрын
Thanks Mike.
@nicolahcm
@nicolahcm 3 жыл бұрын
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.
@martinkottaram5355
@martinkottaram5355 4 жыл бұрын
hear after @3:55
@ahmaddawood9691
@ahmaddawood9691 5 жыл бұрын
EXCELLENT
@thealchemist9781
@thealchemist9781 2 жыл бұрын
Golas~monitor errors ~no eexecution and handle them
@andretheruler714
@andretheruler714 2 жыл бұрын
thank you kind sir
@nobleinexile4296
@nobleinexile4296 4 жыл бұрын
Thanks Mike!
@aldreinmendiola2543
@aldreinmendiola2543 2 жыл бұрын
How can I input this Try/Catch in your last video named Building a Multiple Choive Quiz. I think it would fit perfectly there
@douglasbelton3277
@douglasbelton3277 7 жыл бұрын
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.
@gunnarkennedy3292
@gunnarkennedy3292 5 жыл бұрын
cough cough while loop! for loop maybe if your good :)
@ninabohm1535
@ninabohm1535 3 жыл бұрын
Great video, t!hank you
@fzdz4069
@fzdz4069 4 жыл бұрын
How to use TRY/CATCH inside a nested FOR loop so it wouldn't stop the program or print out nonsense?
@mouhsineomar4383
@mouhsineomar4383 4 жыл бұрын
I think that it will stop the program and get out of the loop to throw the exception
@Nbak-cw7jx
@Nbak-cw7jx 3 жыл бұрын
How about an exception if you input number instead of a letter? is there any?
@Njekt
@Njekt 3 жыл бұрын
I love you.
@aj98767
@aj98767 5 жыл бұрын
Can someone provide in the reply section some further and/or more advance knowledge about using try and catch? Maybe counteractions for most usually encountered problems with exceptions and errors? It would be a great help!
@Antigashlighting
@Antigashlighting Жыл бұрын
S:get a number from user E:whats went wrong /class in java /data type ~store
@nikolasioakimidis3003
@nikolasioakimidis3003 4 жыл бұрын
The only thing I dont understand is what e is on "exception e"
@scottisitt
@scottisitt 4 жыл бұрын
I think it's just a letter assigned as a variable.... like int i.
@imranfaroouq9741
@imranfaroouq9741 4 жыл бұрын
2:15 huhhuu lol.....
@shamikchakraborty3341
@shamikchakraborty3341 4 жыл бұрын
i came here to learn why "throws" is used.
@stevenshrii
@stevenshrii 2 жыл бұрын
Catch(arrayindexoutofboundsexception e | input ismatchexception) e)
@vitor1678
@vitor1678 3 жыл бұрын
Show your picture on thumbnail, this way people who like your vids will find them faster.
@Antigashlighting
@Antigashlighting Жыл бұрын
}catch (Throwable e){ }catch (Error e){
@Antigashlighting
@Antigashlighting Жыл бұрын
Int [ ] numbs={1,2,3}; System.out.println (nums[5]); System.out.print ("enter a number"); Hasilya Exception in thread "main" java.lang.ArrayIndexOutOfBondExeption
@Antigashlighting
@Antigashlighting Жыл бұрын
Scanner keyboardInput=New Scanner (system.in); System.out.println ("enter a number"); Scanner keyboardInput=New Scanner (system.in); System.out.println ("enter a number"); double num =keyboard input.nextDouble( ); }catch (Exeption e) { System.out.println("invalid Input"); Hasilnya Enter a number :a Invalid input System.out.println (e); Hasilnya Enter a number :a Java.util.InputMissmatch exception
@Antigashlighting
@Antigashlighting Жыл бұрын
try { System.out.println(numbs[5]); double num=keyboarInput.nextDouble( ); System.out.println(num); }catch (ArrayIndexOutOfBondExeption e); System.out.println ( e); }catch(InputMismatchExeption e); { System.out.println("Invalid input"); }catch(Exeption e) Hasilnya enter a number: =a Invalid input
Classes & Objects | Java | Tutorial 26
13:52
Giraffe Academy
Рет қаралды 147 М.
Exception Handling in Java Tutorial
13:20
Coding with John
Рет қаралды 425 М.
路飞做的坏事被拆穿了 #路飞#海贼王
00:41
路飞与唐舞桐
Рет қаралды 25 МЛН
Why no RONALDO?! 🤔⚽️
00:28
Celine Dept
Рет қаралды 117 МЛН
She made herself an ear of corn from his marmalade candies🌽🌽🌽
00:38
Valja & Maxim Family
Рет қаралды 16 МЛН
Getters & Setters | Java | Tutorial 31
17:49
Giraffe Academy
Рет қаралды 112 М.
Nested Loops & 2D Arrays | Java | Tutorial 23
13:15
Giraffe Academy
Рет қаралды 113 М.
Inheritance (extends) | Java | Tutorial 34
12:41
Giraffe Academy
Рет қаралды 62 М.
Java custom exceptions 🛑
10:05
Bro Code
Рет қаралды 80 М.
Try This if You Don’t Like Python’s Exception Handling
21:27
Checked vs. Unchecked Exceptions in Java Tutorial - What's The Difference?
10:14
Java Custom Exceptions Tutorial - It's Way Easier Than You Think
14:29
Coding with John
Рет қаралды 168 М.
Working With Strings - Java - Tutorial 7
17:23
Giraffe Academy
Рет қаралды 47 М.
Interface Inheritance (implements) | Java | Tutorial 35
12:32
Giraffe Academy
Рет қаралды 54 М.
#82 Ducking Exception using throws in Java
9:55
Telusko
Рет қаралды 85 М.
路飞做的坏事被拆穿了 #路飞#海贼王
00:41
路飞与唐舞桐
Рет қаралды 25 МЛН