Home
» Posts filed under
exceptions
June 29, 2021
Ravi Yasas
java.lang.NullPointerExceptionWhen can it be thrown?According to the JavaDoc, the following scenarios can be found.Calling the instance method of a null object.Accessing or modifying the field of a null object.Taking the length of null as if it were an array.Accessing or modifying the slots of null...
June 26, 2021
Ravi Yasas
Throw vs throwsThrowThrowsUses inside a method when it is required to throw an exceptionThis is used in the method signature in which methods that exceptions can occur. Only one exception can be thrownThrows can be used to declare multiple exceptionsUsed to handle unchecked exceptionsUsed to handle...