throw Keyword The throw keywords can be used in Java program to throw exceptions objects in explicit way. The syntax of using throw is as follow: throw ThrowableInstance; The ThrowableInstance can be objects of Throwable classes or any of its sub class. A reference to the Throwable instance can be obtained using the parameters in catch block or by using the new operators. Let’s see a sample programs that demonstrates the use of throw: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 class ArrayExceptions { public static void main(String args) { try { throw new ArithmeticExceptions(“Test throw”); } catch(Exception em) {
The post What is a Throwable instance in java Programming appeared first on Coding Security.
What is a Throwable instance in java Programming
read more
Tidak ada komentar:
Posting Komentar