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); }
@@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!.
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?
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
Ahhh, a siting at my desk with a coffee ....watching a cool RUclips video about it......and do not have to go through stacks overflow what else is needed....COOL!!!!😎😎
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!
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!
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();
}
}
}
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);
}
@@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!.
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?
@@oscarjosefsson9300 you can name it anything you want. E is just standard
@@dd0n396 Thanks! 👍
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
honestly i thought bucky from the newboston did a decent job as well. granted i never made it past video 40 lol.
Your channel is really helpful. Hope you will continue with this. Don't stop, bro!
I appreciate how you explain the important concepts in a very simple and brief manner. Try block ,catch block and finally.Thank you
Explained so simply. I really appreciate it.
Confidence in Ability to Learn Information . . . Restoring(45%) . . . (99%). . .
Really like your clear short presentations, thank you. Keep up the good work!
You are the best teacher! Now I understand why different exceptions are used.
One of my favorite channels for java on RUclips!!
great simple explaination
bro you are so underrated, you cleared things up so much after my lecture
I spent 3hours in class trying to understand this and you do it in 7min52s ... wow you saves me.
I really love java ..U made it more fun and interesting..THANKS BRO!
Best teacher on all of RUclips!!!
I really like how basic it all looks like, just for people to understand the concept. Thx bro!
No cap the best straightforward and simple tutorials ever
You are really amazing to explain everything. Never stop to make videos!
very helpful. i never understood these try catch stuff before. finally i understand. thanks ma bro
Clear and concise as always. Thanks bro. You're at 999k subs as of today! Congrats on (inevitably) hitting 1 mil!!!
Ahhh, a siting at my desk with a coffee ....watching a cool RUclips video about it......and do not have to go through stacks overflow what else is needed....COOL!!!!😎😎
you are very good at it, just I. 7 min you have explain it clearly more than RUclips who does it in 20 min
2:22 - Surroud any Dangerous code with the try block. Haha that was amazing bro!
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♥♥♥
Glad you like them! Thanks for watching Rochelle!
great video!!! I'm infinitely grateful for your dedication and big heart to share this knowledge with the world. Thank you soo much
I watched this video to solve a question on hackerank, which I haven't solved in 6 months. It seems easy now, thanks bro
Nicely defined about exception bro, i like the way you teach bro...
Hahah I literally like this video, everytime you create a catch function, you don't forget to include a silly word🤪😂😂😂
Great videos bro. Love that you cover so much in one Channel. Keep it up Bro!
This just helped me out so much. Thank you fellow bro
Now i know how to handle exception. Thanks bro.
thanks for summarizing what my lecturer spent 1,5h talking about !
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...
i really love the way you explained it, thank you..
brooo you videos is educational at somehow entertaining hahahaa
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
Glad to have you here Kairav!
Could you upload some vids in your gaming channel too? Like maybe once a week if you are busy or something.
I passed my exam because of you KINGGGGGGGG
bro, your my go to when my teacher fails me. Thank you.
recommended your channel to all my juniors
thank u i wish every one explains in ur way
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!
Excellent teaching
God level explanation bro😎
Thanks Bro, I really needed this for my comp sci class 👍
best explanation out there! thanks sm
Damn!! What a simple and easy way to teach
thanks for clear explanation
Thank you Bro code for the amazing tutorials, they are a life saver.
Great explanation, i love the way of teaching , keep doing bro
Nice Bruhh I love Your Video
Great playlist
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!
thanks for watching Hemanth!
goood content
your videos are very helpful
Bien expliqué.
Merci Monsieur
DROP a COMMENT down below
dope video
continue always
very usefullll
It was interesting and good to know! Thanks 🙂 I will follow you!
Last minute studying, thanks bro 😂🔥💔
my go to java tutorial channel
good one !!
thx. short and easy to understand
Great teaching, Bro!
Thank you bro u really saved my life
tysm for the examples it was clearly understandable :)
BEST CHANEL EVER
actually watching this in class to help me on my lab
That's quite useful, thanks a lot for a video!
very nice, you´re great on it
Another great one 👌
love your vids bro!
i understood try-catch. Thanks Bro
IDK if anyone cares or not but what I liked the most was the fact that in the thumbnail, Naruhodo is screaming "Exception".
Yes! Somebody understands the reference!
Thanks Bro!
Bro, hats off, thanks a million
Thank you Bro, perfect explanation
Thanks, Bro! ☕ You're awesome!
THANKS YOU SAVED MY DAY
good explanation :)
good job bro
Thanks pal, that was quite helpfull
nice
Bro you are Amazing thank you so much
RUclips Algorithm, take this comment and use it to spread this AMAZING channel.
Thanks!😁
thank you, this was helpful
awesome!
Perfect!, thanks.
HUGE THANKS!!!
Your my hero bro
best
should the error be exactly inside the catch parenthesis? like catch (ArithemeticException) for the arithmetic exception
thanks brocode for the toturial
Bro doing God's work
catch(Exception e)
Pokémon exception handling.
Gotta catch ‘em all.
Bro!! love you
thnx as alwayas
ur the best
cheers
Pretty cool bro