What occurs when you call a method on a reference variable that contains null? Select one: a. An ArrayIndexOutOfBoundsException error b. An ArithmeticException error c. A NullPointerException error d. A ClassCastException error

Respuesta :

Limosa

Answer:

Option(c) i.e "A NullPointerException error " is the correct answer for the given question.

Explanation:

Exception are the run time error in the program.A NullPointerException is the runtime error when the pointer containing the NULL value .This type of exception occur when we call that function on the pointer variable which contains the NULL.

  • ArrayIndexOutOfBoundsException error occur when we accessing the element which is out of the index or bound so this option is incorrect.
  • An ArithmeticException error  occur in the arithmetic operation. Suppose a number is divided by zero then the ArithmeticException error is occured .
  • ClassCastException error occur in the typecasting of a specific object.So this option is incorrect.