Java exception handling ⚠️

  Рет қаралды 97,666

Bro Code

Bro Code

3 жыл бұрын

Java exception exceptions handling try catch finally
#Java #exception #exceptions #handling #try #catch #finally

Пікірлер: 220
@BroCodez
@BroCodez 3 жыл бұрын
import java.util.InputMismatchException; import java.util.Scanner; public class Main { public static void main(String[] args) { // exception = an event that occurs during the execution of a program that, // disrupts the normal flow of instructions Scanner scanner = new Scanner(System.in); try { System.out.println("Enter a whole number to divide: "); int x = scanner.nextInt(); System.out.println("Enter a whole number to divide by: "); int y = scanner.nextInt(); int z = x/y; System.out.println("result: " + z); } catch(ArithmeticException e) { System.out.println("You can't divide by zero! IDIOT!"); } catch(InputMismatchException e) { System.out.println("PLEASE ENTER A NUMBER OMFG!!!"); } catch(Exception e) { System.out.println("Something went wrong"); } finally { scanner.close(); } } }
@haruamia7931
@haruamia7931 2 жыл бұрын
Why use int not double? cant 5/2 with int... try { System.out.println("Enter a whole number to divide: "); double x = scanner.nextDouble(); System.out.println("Enter a whole number to divide by: "); double y = scanner.nextDouble(); double z = x/y; System.out.println("result: " + z); }
@guytordjman7166
@guytordjman7166 2 жыл бұрын
@@haruamia7931 this will not throw an exception. If y=0 then z is infinity. Arithmetic exception is thrown only when dealing with integer division - give it a try!.
@oscarjosefsson9300
@oscarjosefsson9300 Жыл бұрын
Excuse my but what is the "e" after Exception? Is e an object? Is there any special reason for calling it e? Is there a risk of creating more than one object since e is used for all the catchers?
@dd0n396
@dd0n396 Жыл бұрын
​@@oscarjosefsson9300 you can name it anything you want. E is just standard
@oscarjosefsson9300
@oscarjosefsson9300 Жыл бұрын
@@dd0n396 Thanks! 👍
@alexshepel5599
@alexshepel5599 3 жыл бұрын
Your channel is really helpful. Hope you will continue with this. Don't stop, bro!
@andrevandenheever6740
@andrevandenheever6740 3 жыл бұрын
Really like your clear short presentations, thank you. Keep up the good work!
@jamesarden7554
@jamesarden7554 2 жыл бұрын
This is by far the best explained java course out there and i have seen loads!!! Concepts i have had trouble with are now no problem thanks to this channel plus i have learned stuff i never even knew java could do
@thewewguy8t88
@thewewguy8t88 Жыл бұрын
honestly i thought bucky from the newboston did a decent job as well. granted i never made it past video 40 lol.
@paulinewachira5839
@paulinewachira5839 2 ай бұрын
I appreciate how you explain the important concepts in a very simple and brief manner. Try block ,catch block and finally.Thank you
@cuca3243
@cuca3243 11 ай бұрын
You are the best teacher! Now I understand why different exceptions are used.
@huzaifafaisal5019
@huzaifafaisal5019 3 жыл бұрын
bro you are so underrated, you cleared things up so much after my lecture
@stephenbond9487
@stephenbond9487 2 жыл бұрын
No cap the best straightforward and simple tutorials ever
@eyashamdan4371
@eyashamdan4371 Ай бұрын
Best teacher on all of KZbin!!!
@adityasharma6132
@adityasharma6132 Жыл бұрын
You are really amazing to explain everything. Never stop to make videos!
@miyaspapa5628
@miyaspapa5628 Жыл бұрын
Clear and concise as always. Thanks bro. You're at 999k subs as of today! Congrats on (inevitably) hitting 1 mil!!!
@gutside8069
@gutside8069 8 ай бұрын
Explained so simply. I really appreciate it. Confidence in Ability to Learn Information . . . Restoring(45%) . . . (99%). . .
@Edna_Konrad
@Edna_Konrad Жыл бұрын
I really like how basic it all looks like, just for people to understand the concept. Thx bro!
@kayleighrenner829
@kayleighrenner829 2 жыл бұрын
One of my favorite channels for java on KZbin!!
@kristynicole6201
@kristynicole6201 2 жыл бұрын
Amaaazzzing tutorials, so helpful. Don't stop making tutorials please!
@skl7714
@skl7714 3 жыл бұрын
I really love java ..U made it more fun and interesting..THANKS BRO!
@rajneelram4229
@rajneelram4229 2 жыл бұрын
Appreciate how you explain how to put the exception in blocks, I have been trying to find a decent example of how it works with the code portion. Thank you!
@chillwavefrequency8108
@chillwavefrequency8108 Жыл бұрын
Great videos bro. Love that you cover so much in one Channel. Keep it up Bro!
@omersond4891
@omersond4891 3 жыл бұрын
very helpful. i never understood these try catch stuff before. finally i understand. thanks ma bro
@notahmed6682
@notahmed6682 2 ай бұрын
i really love the way you explained it, thank you..
@Garrison86
@Garrison86 2 жыл бұрын
Thank you Bro code for the amazing tutorials, they are a life saver.
@atulgurung6213
@atulgurung6213 9 күн бұрын
Nicely defined about exception bro, i like the way you teach bro...
@deltashit
@deltashit 2 жыл бұрын
Thank you! Now I finally understand the try and catch blocks. But why is the finally block even needed? Could you not just write the code inside the finally block after the whole try-catch and it would still be executed just fine?
@eyobabebe7536
@eyobabebe7536 2 жыл бұрын
Great explanation, i love the way of teaching , keep doing bro
@ShermukhammadKarimov
@ShermukhammadKarimov Ай бұрын
thanks for clear explanation
@issker8840
@issker8840 3 ай бұрын
love your vids bro!
@rochellemellomida9972
@rochellemellomida9972 3 жыл бұрын
Hello bro, i really love watching your videos, these helped me a lot as a self-learner and beginner in java greetings from the Philippines♥♥♥
@BroCodez
@BroCodez 3 жыл бұрын
Glad you like them! Thanks for watching Rochelle!
@kameshwaranr3569
@kameshwaranr3569 2 ай бұрын
God level explanation bro😎
@danishhussain9642
@danishhussain9642 2 ай бұрын
Great teaching, Bro!
@naledimotsoikha6807
@naledimotsoikha6807 Жыл бұрын
I spent 3hours in class trying to understand this and you do it in 7min52s ... wow you saves me.
@kairavpathak2178
@kairavpathak2178 3 жыл бұрын
I subbed. Ur videos are so easy to understand. Thank god I found your channel. Otherwise I would be lost in the yt coding world
@BroCodez
@BroCodez 3 жыл бұрын
Glad to have you here Kairav!
@kairavpathak2178
@kairavpathak2178 3 жыл бұрын
Could you upload some vids in your gaming channel too? Like maybe once a week if you are busy or something.
@vklmao8677
@vklmao8677 3 жыл бұрын
Ahhh, a siting at my desk with a coffee ....watching a cool KZbin video about it......and do not have to go through stacks overflow what else is needed....COOL!!!!😎😎
@fire_krystal
@fire_krystal 10 ай бұрын
best explanation out there! thanks sm
@Stella-ic7nc
@Stella-ic7nc 3 ай бұрын
thanks for summarizing what my lecturer spent 1,5h talking about !
@Ragehunter
@Ragehunter Жыл бұрын
tysm for the examples it was clearly understandable :)
@ivanpryhorshnia6854
@ivanpryhorshnia6854 2 жыл бұрын
That's quite useful, thanks a lot for a video!
@fareskamal4145
@fareskamal4145 2 жыл бұрын
thank u i wish every one explains in ur way
@fakharjafri3505
@fakharjafri3505 9 ай бұрын
I watched this video to solve a question on hackerank, which I haven't solved in 6 months. It seems easy now, thanks bro
@adarshvardan6825
@adarshvardan6825 11 ай бұрын
your videos are very helpful
@azerpashahuseynli444
@azerpashahuseynli444 3 жыл бұрын
Thank you Bro, perfect explanation
@AdelitoTeca-mi6xg
@AdelitoTeca-mi6xg 2 ай бұрын
very nice, you´re great on it
@shockwave2477
@shockwave2477 3 жыл бұрын
Great playlist
@helenaa1304
@helenaa1304 7 ай бұрын
Thanks Bro, I really needed this for my comp sci class 👍
@dhmilan6077
@dhmilan6077 Жыл бұрын
Damn!! What a simple and easy way to teach
@anapopova9199
@anapopova9199 Жыл бұрын
It was interesting and good to know! Thanks 🙂 I will follow you!
@amada.10
@amada.10 3 жыл бұрын
Hahah I literally like this video, everytime you create a catch function, you don't forget to include a silly word🤪😂😂😂
@chrisstuff8235
@chrisstuff8235 Жыл бұрын
Bien expliqué. Merci Monsieur
@113_03
@113_03 Жыл бұрын
Thank you bro u really saved my life
@danny.3036
@danny.3036 3 жыл бұрын
Thanks, Bro! ☕ You're awesome!
@FarizDarari
@FarizDarari Жыл бұрын
HUGE THANKS!!!
@thanhhuyvu4530
@thanhhuyvu4530 2 жыл бұрын
i understood try-catch. Thanks Bro
@michael_scarn_
@michael_scarn_ Жыл бұрын
Bro, hats off, thanks a million
@mpbabu80
@mpbabu80 2 жыл бұрын
Excellent teaching
@infinitepossibilities2614
@infinitepossibilities2614 2 жыл бұрын
2:22 - Surroud any Dangerous code with the try block. Haha that was amazing bro!
@RK_Rom30
@RK_Rom30 2 жыл бұрын
brooo you videos is educational at somehow entertaining hahahaa
@user-eo6sv1gs7p
@user-eo6sv1gs7p 4 күн бұрын
Nice Bruhh I love Your Video
@xxg3fallxx589
@xxg3fallxx589 10 ай бұрын
very nice explanation
@user-ed7ue4fu6z
@user-ed7ue4fu6z 11 ай бұрын
Thanks pal, that was quite helpfull
@fitzsimmons7
@fitzsimmons7 4 ай бұрын
thank you, this was helpful
@amadujalloh4700
@amadujalloh4700 3 жыл бұрын
Geez what is more beautiful than reading Big Java text book and watching the practicals here with my bro? Nothing is better in Java than @Bro code...
@cosecE
@cosecE 2 жыл бұрын
recommended your channel to all my juniors
@airadjurad8934
@airadjurad8934 8 ай бұрын
good explanation :)
@lm_slayer1
@lm_slayer1 Жыл бұрын
I passed my exam because of you KINGGGGGGGG
@alanwarthon
@alanwarthon 11 ай бұрын
Perfect!, thanks.
@user-et7bw8hn9m
@user-et7bw8hn9m 6 ай бұрын
bro, your my go to when my teacher fails me. Thank you.
@firsttime8064
@firsttime8064 6 күн бұрын
love u man, thx
@hemanthneupane8608
@hemanthneupane8608 3 жыл бұрын
I subscribed your channel right away I saw this series. I was having trouble learning java and i had not found any good videos on youtube. Thank you! Your videos are helping me all way out!
@BroCodez
@BroCodez 3 жыл бұрын
thanks for watching Hemanth!
@azizt6773
@azizt6773 7 ай бұрын
Bro you are Amazing thank you so much
@shukragaming
@shukragaming Жыл бұрын
THANKS YOU SAVED MY DAY
@kemann3815
@kemann3815 2 жыл бұрын
Another great one 👌
@user-sn1vn2ik2o
@user-sn1vn2ik2o 4 күн бұрын
awesome!
@salahadinshemsu6186
@salahadinshemsu6186 Жыл бұрын
Bro!! love you
@lucnahounou
@lucnahounou 8 ай бұрын
Thanks!😁
@minhtetpaing1695
@minhtetpaing1695 3 жыл бұрын
Thank you so much sir.
@avoisavo
@avoisavo 2 ай бұрын
very usefullll
@speklex779
@speklex779 9 ай бұрын
dope video
@codesloth940
@codesloth940 2 жыл бұрын
Your my hero bro
@javacnc9863
@javacnc9863 2 жыл бұрын
ThankYou !!!
@darshanraval230
@darshanraval230 Жыл бұрын
Thanks Bro!
@TheEvertonDias
@TheEvertonDias Жыл бұрын
Thanks, Bro!
@Aman-xo4yx
@Aman-xo4yx 2 ай бұрын
my go to java tutorial channel
@pouspot616
@pouspot616 Жыл бұрын
thanks brocode for the toturial
@aliaskararzykulov2361
@aliaskararzykulov2361 2 жыл бұрын
good job bro
@amanmourya1451
@amanmourya1451 4 ай бұрын
Thanks Bro.
@futbolmanyatv1872
@futbolmanyatv1872 Жыл бұрын
Thank you.
@rinadem5219
@rinadem5219 Жыл бұрын
the best thank you
@nourialsayed
@nourialsayed 3 жыл бұрын
BEST CHANEL EVER
@GaurabSharma-oo8xu
@GaurabSharma-oo8xu Ай бұрын
should the error be exactly inside the catch parenthesis? like catch (ArithemeticException) for the arithmetic exception
@Emir-yo8ek
@Emir-yo8ek 11 ай бұрын
Ty man!
@eugenezuev7349
@eugenezuev7349 27 күн бұрын
much appreciate, Bro
@trinithvihanga5084
@trinithvihanga5084 2 ай бұрын
goood content
@catherineossah6276
@catherineossah6276 3 жыл бұрын
i love you Bro !!
@frankH117
@frankH117 2 жыл бұрын
Thanks!!!
@itzyuzuruclips
@itzyuzuruclips 10 ай бұрын
Pretty cool bro
@peliscocushd.4788
@peliscocushd.4788 2 ай бұрын
thanks bro
@danielsullivan5287
@danielsullivan5287 Жыл бұрын
actually watching this in class to help me on my lab
@kippenvogelchen9717
@kippenvogelchen9717 3 жыл бұрын
very good!
@thiquang37
@thiquang37 Жыл бұрын
thank you bro.
@sairos4057
@sairos4057 Жыл бұрын
thankx bro
@dhrubarajroy_0865
@dhrubarajroy_0865 3 жыл бұрын
nice
Java File class 📁
7:20
Bro Code
Рет қаралды 77 М.
Java custom exceptions 🛑
10:05
Bro Code
Рет қаралды 69 М.
СҰЛТАН СҮЛЕЙМАНДАР | bayGUYS
24:46
bayGUYS
Рет қаралды 734 М.
ONE MORE SUBSCRIBER FOR 6 MILLION!
00:38
Horror Skunx
Рет қаралды 12 МЛН
О, сосисочки! (Или корейская уличная еда?)
00:32
Кушать Хочу
Рет қаралды 8 МЛН
Try Catch Java Tutorial #46
11:05
Alex Lee
Рет қаралды 215 М.
Java interface 🦅
7:51
Bro Code
Рет қаралды 173 М.
Java Exception Handling Tutorial
11:39
Keep On Coding
Рет қаралды 80 М.
Java Custom Exceptions Tutorial - It's Way Easier Than You Think
14:29
Coding with John
Рет қаралды 144 М.
15 crazy new JS framework features you don’t know yet
6:11
Fireship
Рет қаралды 394 М.
Java multithreading 🧶
15:18
Bro Code
Рет қаралды 118 М.
Java objects (OOP) ☕
10:46
Bro Code
Рет қаралды 149 М.
Learn Stack data structures in 10 minutes 📚
10:07
Bro Code
Рет қаралды 180 М.
Exception Handling in Java Tutorial
13:20
Coding with John
Рет қаралды 353 М.
Advanced Exception Handling in Python
12:06
NeuralNine
Рет қаралды 52 М.
wyłącznik
0:50
Panele Fotowoltaiczne
Рет қаралды 22 МЛН
Дени против умной колонки😁
0:40
Deni & Mani
Рет қаралды 9 МЛН
AMD больше не конкурент для Intel
0:57
ITMania - Сборка ПК
Рет қаралды 499 М.
A Comprehensive Guide to Using Zoyya Tools for Photo Editing
0:50
Xiaomi Note 13 Pro по безумной цене в России
0:43
Простые Технологии
Рет қаралды 1,9 МЛН