Difference between throw and throws - Java

Difference between throw and throws

The throw key word is used to explicitly throw an exception, while throws is utilized to handle checked exceptions for re-intimating the compiler that exceptions are being handled. It is kind of communicating to the compiler that an exception is expected to throw one or more checked exceptions.

The throws need to be used in the method’s definition and also while invoking the method that raises checked exceptions.
Explain the ways to serialize the java object
Object serialization could be used in different ways: - Simple persistence of the object...
Similarities between an array and an ArrayList - Java
The following are the similarities between an array and an ArrayList: - Both array and ArrayList can have duplicate elements in them...
Can we decide a session bean as stateless or stateful without seeing jar file?
A bean can be determined whether is a stateless or stateful by analyzing the deployment descriptor ejb-jar.xml...
Post your comment