what difference between throw and throws in exception
handling.

Answer Posted / dani

You can declare multiple exception thrown by method in
throws keyword by separating them in common
e.g. throws IOException, ArrayIndexBoundException etc,

while you can only throw one instance of exception using
throw keyword e.g. throw new IOException("not able to open
connection").

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is JFC?

707


List down the methods and interfaces of collection class in java.

539


we have syntax like for(int var : arrayName) this syntax is to find whether a number is in the array or not.but i want to know how to find that number's location.

1569


What is an iterator java?

531


Why java does not support pointers?

560






Why there are some null interface in java? What does it mean?

643


What is finalize() function in java?

563


What are the methods used to implement for the key object in the hash map?

567


Is array a class?

517


Class c implements interface I containing method m1 and m2 declarations. Class c has provided implementation for method m2. Can I create an object of class c?

1020


What is java argument list?

520


Difference between current previous versions of Java?

557


When do we use synchronized methods in java?

582


What are the main differences between the java platform and other platforms?

528


How many bits is a boolean?

620