Answers for "why i do i have to use throw in java"

2

throw error java

throw new java.lang.Error("this is very bad");
throw new java.lang.RuntimeException("this is not quite as bad");
Posted by: Guest on March-21-2021
1

throw keyword in java

Generally JVM throws the exception and
we handle the exceptions by 
using try catch block. But there are
situations where we have to throw 
userdefined exceptions or runtime exceptions.
  In such case we use throw keyword 
to throw exception explicitly.

  Syntax : throw throwableInstance;
Posted by: Guest on January-05-2021

Code answers related to "why i do i have to use throw in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language