// ***************************************************** public class AgeException extends Exception{
AgeException(String message){ super(message); } } // ***************************************************** import java.util.Scanner; public class Main { public static void main(String args[]){
Scanner scan = new Scanner(System.in); System.out.print("Enter your age: "); int age = scan.nextInt();
Isn't he really something? The introductions and conclusions really lift my mood. Even representing a dragon to defeat the YT algorithm!🤣Content is worth a million dollars! The only thing that I'm hating right now is the nostalgia the electronic music gives me at the end. My high school would play these same tracks when ending classes.😭
Sir, you are, indeed, a hero. I've just passed my programming exam with a score of 25/30. All of your explainations alongside my friends' taught me programming waaaaay better than the university professor and textbooks and I've aced. I'm commenting on this particoular video because it's the one I've seen the most. Absolute legend!
Thank you, I understood about the custom exception, before this video, I didn't have idea how to create one. I subscribed, I'll keep watching more videos
Bro, why do all this through an "exception" instead of a simple if / else statement? I am not experienced enough to have an opinion. Just trying to understand. Thank you!
custom exceptions can also be used to show stacktrace and method calls, information like this not only improves the debugging of code it also makes it a lot cleaner and readable in comparison to bulky if else statements
Just for clarity especially in big projects If you use if else for every exception you will end up having multiple conditions which will be alot confusing. So, instead we use try catch block so when youor someone read your code it’s alot easier to identify what the code does.
} static void checkHeight(int height) throws HeightException { if(height < 160 ) { throw new HeightException("You are not tall enough to go on the ride."); } else { System.out.println("You are tall enough to go on the ride."); } } } public class HeightException extends Exception{ HeightException(String message){ super(message); } }
Sir,I am very sorry to disturb you. I wonder why in Java IO stream always use 8kb bytes to input or out put data? Why don’t we use a larger size array? If we use a larger size, don’t we just simply get read and write much faster? So why don’t we use a larger size of array? And in sql, we just need to avoid use too much times of IO, we don’t need to worry about limited 8kb, why???
I have not yet found the answer, but I did find some documentation that explains IO stream in depth: docs.oracle.com/javase/tutorial/essential/io/streams.html
Bro Code Buffered byte steams which is BufferedOutputStream and BufferedInputstream, and both of them use 8kb bytes array as buffer area which is 8192 bit.
Hey thanks a lot for the video! Quick question, on the catching side of the code, you used the "Exception e". If i put there instead of Exception e, my own exception will this be a problem in case other exceptions occur? Is it advisable to keep both the Exception e and add another catch after that for my own exception?
Bro, I know it's been a long time since you uploaded this video, but i have a question about custom exceptions: is there a way to make one of those custom tooltips to surround something with a try and catch block with my custom exception faster? You know, when you type something like a dangerous method and it gives you a "quick fix" by surrounding the method call with a try and catch block by itself, is there a way to make a "custom quick fix" by myself?
Question Write a program to accept email address from a user and throw user defined exception if it does not contain @ symbol. import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc =new Scanner(System.in); System.out.println("Enter Your Email"); String Email =sc.nextLine(); try{ checkEmail(Email); } catch (Exception e){ System.out.println("A Problem occured"+e); } } static void checkEmail(String Email)throws EmailException{ if (Email = ){ throw new EmailException("plese enter valid email:"); } else{ System.out.println("Your are Sign up "); } } } Sir What should we used in if block for verifying It Contain @symbol or not
SORRY I came from your first video I need HELP! I accidentally deleted the left hand side of the program where it says package explorer how do I get it back?!!?
Kirsty Holmes no way. If you use java file’s class method to delete, it will delete forever, it’s not like windows to put files in your garage bin. But if you really need to recover, I can send you a disc scanner software for you to recover. It can recover in most case, but I won’t promise you it will surely success.
import java.util.Scanner; class AE extends Exception { AE(String m) { super(m); } } class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int age; age = s.nextInt(); try { if (age < 18) { throw new AE("You are not 18"); } else { System.out.println("You are 18+"); } } catch (AE e) { System.out.println("An error occurred: " + e.getMessage()); } } }
Yo just wanna say that GOD loved the world so much he sent his only begotten son Jesus to die a brutal death for us so that we can have eternal life and we can all accept this amazing gift this by simply believing in him (Jesus) asking for the forgiveness of your sins and forming a relationship with heavenly father. ..>>>>....
// *****************************************************
public class AgeException extends Exception{
AgeException(String message){
super(message);
}
}
// *****************************************************
import java.util.Scanner;
public class Main {
public static void main(String args[]){
Scanner scan = new Scanner(System.in);
System.out.print("Enter your age: ");
int age = scan.nextInt();
try{
checkAge(age);
}
catch(Exception e)
{
System.out.println("A problem occured: "+e);
}
}
static void checkAge(int age)throws AgeException{
if(age
You're the best programming teacher on youtube! Has helped me tremendously!
Isn't he really something? The introductions and conclusions really lift my mood. Even representing a dragon to defeat the YT algorithm!🤣Content is worth a million dollars! The only thing that I'm hating right now is the nostalgia the electronic music gives me at the end. My high school would play these same tracks when ending classes.😭
Sir, you are, indeed, a hero. I've just passed my programming exam with a score of 25/30.
All of your explainations alongside my friends' taught me programming waaaaay better than the university professor and textbooks and I've aced. I'm commenting on this particoular video because it's the one I've seen the most. Absolute legend!
You're a legend! These 10 minutes taught me more than my professor did in 1.5 hours.
Bro, I’m in a bootcamp right now and I swear you teach better than any teacher I’ve had. I appreciate you 🙏🏾
Udemy: We will take your money and will teach you shit
Bro: I Am GoNnA EnD ThIS MaN'S WhOlE CaReeR
lololololol
Thank you, I love how you show thing without unnecessary clogging. Great video
This is my best of best teachers in my programming studies
You rock dude! Thanks for the you are a phenomenal teacher, its all about the analogies.
Thank you, I understood about the custom exception, before this video, I didn't have idea how to create one. I subscribed, I'll keep watching more videos
Bro, why do all this through an "exception" instead of a simple if / else statement? I am not experienced enough to have an opinion. Just trying to understand. Thank you!
custom exceptions can also be used to show stacktrace and method calls, information like this not only improves the debugging of code it also makes it a lot cleaner and readable in comparison to bulky if else statements
probably not needed for small programs… but in big projects it'll be better to do that.
So knowing it is good.
Just for clarity especially in big projects
If you use if else for every exception you will end up having multiple conditions which will be alot confusing.
So, instead we use try catch block so when youor someone read your code it’s alot easier to identify what the code does.
Legend!!
thank you so much for the help!
Thank you ❤
Very very thank you.
public class NegativeAgeException extends Exception{
NegativeAgeException(String message){
super(message);
}
}
///////////////////////////////////////////////////////////////////////////////////
static void checkAge(int age)throws NegativeAgeException {
if (age
I loled at "You must be born to sign up"
xD
Excellent ! Very helpful ! Thank you very much !
Thanks for everything!!!! U R AMAZING!
amazing explanation]
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("Enter your height in cm: ");
int height = scan.nextInt();
try {
checkHeight(height);
}
catch(HeightException e) {
System.out.println("You don't reach the minimum height: " + e);
}
}
static void checkHeight(int height) throws HeightException {
if(height < 160 ) {
throw new HeightException("You are not tall enough to go on the ride.");
}
else {
System.out.println("You are tall enough to go on the ride.");
}
}
}
public class HeightException extends Exception{
HeightException(String message){
super(message);
}
}
your videos are very helpful
thanks! your videos are good as always:)
Thank you Bro Code, You're the Bro!❤❤
very useful thnaks...
thanks to you i finnally understand exceptions! Thank you!
nta nadi a sat
Great video
Great tutorial! I was trying to figure out a condition which verifies if a non-numeric key was entered. I'm kinda puzzled..
sweeet
Thank you for your effort 😊
Would you please make a video about do post request to a URL.
Best Teacher
Sir,I am very sorry to disturb you. I wonder why in Java IO stream always use 8kb bytes to input or out put data? Why don’t we use a larger size array? If we use a larger size, don’t we just simply get read and write much faster? So why don’t we use a larger size of array? And in sql, we just need to avoid use too much times of IO, we don’t need to worry about limited 8kb, why???
hmmm let me do some research, that is a difficult question. I will see what I can find
I have not yet found the answer, but I did find some documentation that explains IO stream in depth: docs.oracle.com/javase/tutorial/essential/io/streams.html
Bro Code Buffered byte steams which is BufferedOutputStream and BufferedInputstream, and both of them use 8kb bytes array as buffer area which is 8192 bit.
I have lab about how to make exception,
Thank you Bro code.
Nice
you are great bro you so good for my feature thank you for everythings.
Thanks Bro. Great job. Keep on doing those vids.
You are legend 😂🎉
Amazing video, helped me a lot :)
Thank you Bro.... This code helps me alot Bro From Bro Code Bro... ❤️👍😜
Great video!!!
Hey thanks a lot for the video! Quick question, on the catching side of the code, you used the "Exception e". If i put there instead of Exception e, my own exception will this be a problem in case other exceptions occur? Is it advisable to keep both the Exception e and add another catch after that for my own exception?
I can't ask for a best teacher
very clear~ Thanks Bro.
Created something similar but made it a PokedexException that only accepts entries 1 to 1008, anything else would throw the exception.
greaaat work broooo
Thank you very much
Damn Bro is Amazing
thanks for the vids brah
thanks mate❤🔥
nice
Lovely
Thank you so much Bro!
Bro, what if we want to use Exceptions for a String/Strings?
Bro, I know it's been a long time since you uploaded this video, but i have a question about custom exceptions: is there a way to make one of those custom tooltips to surround something with a try and catch block with my custom exception faster? You know, when you type something like a dangerous method and it gives you a "quick fix" by surrounding the method call with a try and catch block by itself, is there a way to make a "custom quick fix" by myself?
How to handle exceptions in return type method?
thank you for saving me
static void checkXP (int x) throws XPExeption{
switch (x){
case 1:
System.out.println("NIVEL 1");
break;
case 2:
System.out.println("NIVEL 2");
break;
case 3:
System.out.println("NIVEL 3");
break;
default:
throw new XPExeption("NOT VALID");
}
}
sir love from bangladesh but i have a question why have you used static block in this code
Nice, bro!
you're the best
thanks bro
THANK YOU!!!!
Thank you
honestly idk what i am typing here ,i am just following your command sir😁...ig i can proceed to the video..yeah
Nice, thanks
I remember you Ivan! Hello!
@@BroCodez Heya
how did u extend Exception in ageException but there is no exception class???
Java has an Exception class by default, like Math class.
thank you so much
Thanks bro.
thnks dude
Thanks
thanks ,broo
75 videos seen! aiming to see til 125 (bc i don't have that much interest on JavaFX)
thank you
❤❤
you're the bro
Adoro estos videos aunque no sé inglés xD
حتى انا😂
nice, bro :^)
78th. Thank you, ma Bro Sensei
i think i should see the video at first then commit
Question
Write a program to accept email address from a user and throw user defined exception if
it does not contain @ symbol.
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc =new Scanner(System.in);
System.out.println("Enter Your Email");
String Email =sc.nextLine();
try{
checkEmail(Email);
}
catch (Exception e){
System.out.println("A Problem occured"+e);
}
}
static void checkEmail(String Email)throws EmailException{
if (Email = ){
throw new EmailException("plese enter valid email:");
}
else{
System.out.println("Your are Sign up ");
}
}
}
Sir What should we used in if block for verifying It Contain @symbol or not
whatsup bro
SORRY I came from your first video I need HELP! I accidentally deleted the left hand side of the program where it says package explorer how do I get it back?!!?
Kirsty Holmes no way. If you use java file’s class method to delete, it will delete forever, it’s not like windows to put files in your garage bin. But if you really need to recover, I can send you a disc scanner software for you to recover. It can recover in most case, but I won’t promise you it will surely success.
If you use eclipse.
window - show view - package explorer (if you are using eclipse)
😎😎😎😎😎😎😎
vunderbar
w
brooooo
Ly bro 6
Need rewatch
algo
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Is Bro king?
y/n");
String answer = scanner.next();
try {
nonSenseFilter(answer);
} catch(SpecificException e) {
System.out.println(e);
} finally {
System.out.println("Bro is the king!");
}
}
public static void nonSenseFilter(String answer) throws SpecificException {
if (!answer.equals("y")) {
throw new SpecificException("Stop typing gibberish!");
} else {
System.out.println("You goddamn right!");
}
}
}
Comment
import java.util.Scanner;
class AE extends Exception {
AE(String m) {
super(m);
}
}
class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int age;
age = s.nextInt();
try {
if (age < 18) {
throw new AE("You are not 18");
} else {
System.out.println("You are 18+");
}
} catch (AE e) {
System.out.println("An error occurred: " + e.getMessage());
}
}
}
mlmlm
comment
Yo just wanna say that GOD loved the world so much he sent his only begotten
son Jesus to die a brutal death for us so that we can have eternal life
and we can all accept this amazing gift this by simply believing in him (Jesus) asking for the forgiveness of your sins
and forming a relationship with heavenly father. ..>>>>....
Thank you
Thanks
Thank you
Thanks
Thanks