What is the purpose of writing custom exception classes when mostly what it does is same. For eg, NullPointerException:
class NullPointerException extends Ru
It is basically to Handle different Exception in different ways. Say, you might want to do some different operation on ArrayIndexOutOfBoundsException than a NumberFormatException.
or more clearly
}catch (ArrayIndexOutOfBoundsException ex){
//operation 1
}catch (NumberFormatException ex){
//operation 2
}