filmov
tv
🔥 Java Exception Wizardry: Mastering Checked and Unchecked Exceptions | JavaTechSolutions

Показать описание
In this tutorial explained how can we create custom exception in Java.
Checked custom exception
Unchecked custom exception
Advantage of using Custom Exception
1. Improved security by hiding technical details of the error and preventing information leakage.
2. Custom exceptions provide you the flexibility to add attributes and methods that are not part of a standard Java exception.
Checked custom exception
=========================
class UserNotFound extends Exception {
private static final long serialVersionUID = 4125559255601374662L;
public UserNotFound(String msg) {
super(msg);
}
}
Unchecked custom exception
========================
class UserNotFoundRuntime extends RuntimeException {
private static final long serialVersionUID = 4125559255601374662L;
public UserNotFoundRuntime(String msg) {
super(msg);
}
}
🎉 Don't forget to like, subscribe, and hit the notification bell to stay updated with our programming tutorials. Happy coding! 💻👩⚕️👨⚕️
#corejava #exceptionhandling #exceptionhandlinginjava #java17 #javaprogramming #java #exception #javatutorialforbeginners
Join this channel to get access to perks:
Checked custom exception
Unchecked custom exception
Advantage of using Custom Exception
1. Improved security by hiding technical details of the error and preventing information leakage.
2. Custom exceptions provide you the flexibility to add attributes and methods that are not part of a standard Java exception.
Checked custom exception
=========================
class UserNotFound extends Exception {
private static final long serialVersionUID = 4125559255601374662L;
public UserNotFound(String msg) {
super(msg);
}
}
Unchecked custom exception
========================
class UserNotFoundRuntime extends RuntimeException {
private static final long serialVersionUID = 4125559255601374662L;
public UserNotFoundRuntime(String msg) {
super(msg);
}
}
🎉 Don't forget to like, subscribe, and hit the notification bell to stay updated with our programming tutorials. Happy coding! 💻👩⚕️👨⚕️
#corejava #exceptionhandling #exceptionhandlinginjava #java17 #javaprogramming #java #exception #javatutorialforbeginners
Join this channel to get access to perks: