• Custom Exceptions using throw keyword

    Maximum MNC company create own structure code. In this structure code they also create Custom Exceptions handling classes, methods and constructors. In this blog example, we create LoginException exception for check login details of admin panel.   LoginException : Custom Exceptions import java.util.*;                   class LoginException extends Exception {             LoginException(String errorMessage)             {                         super(errorMessage);           […]

  • NullPointerException – Handle by throw

    NullPointerException is run time error, when we display object and do not find any value in object. In this blog, we will see how this exception handles by throw keyword.   This example and video work on throw keyword. class A {             void method1()             {                         try                         {                                     //throw new NullPointerException(“Error […]

  • Trace-run time error using try catch keywords

    In this blog, we will see 2 programs. 1st program is not handled and other is handled run time error. Using of these 2 programs we can understand trace-run time error. 1st – program [Trace-run time error] class Exc5 {             static void method1(int x,int y)             {                         int div = x/y;                           System.out.println(“Div […]

  • 1 try – multiple catch handling

    1 try – multiple catch handling is maximum use program in java. In this example we will work on ArrayIndexOutOfBoundsException, ArithmeticException and normal Exception. Here we create one try block with three catch block with three different run time errors.   Let’s see 1 try – multiple catch program with videos   class Exc4 { […]

  • InputMismatchException

    In this blog we work on InputMismatchException with try and catch handler. This is another program on try catch exception handler with InputMismatchException. When user put some text in integer value that time this run time error will generate. Example : We set contact number field as number, but user put some text on field […]