You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// an unchecked exception represents an error in programming logic, not an erroneous situation that might reasonably occur during the proper use of an API.
publicclassUnCheckedNullPointerCases {
publicstaticvoidmain(String[] args) {
Empe = newEmp();
e.getT().getJ(); // Null Point Exception - avoid by using check of null
}
publicvoidarithmaticExce() {
try {
intnum1 = 30, num2 = 0;
intoutput = num1 / num2; // ArithmaticException
System.out.println("Result: " + output);
} catch (ArithmeticExceptione) {
System.out.println("You Shouldn't divide a number by zero");