1.

Which of these exceptions will be thrown if we use null reference for an arithmetic operation?(a) ArithmeticException(b) NullPointerException(c) IllegalAccessException(d) IllegalOperationExceptionI had been asked this question by my school principal while I was bunking the class.I'd like to ask this question from Java’s Built in Exceptions topic in chapter Exploring java.lang & java.io of Java

Answer»

Right CHOICE is (b) NullPointerException

For explanation: If we USE null REFERENCE ANYWHERE in the code where the value stored in that reference is used then NullPointerException occurs.



Discussion

No Comment Found

Related InterviewSolutions