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 does += mean coding?

506


What is the covariant return type?

570


What is array list in java?

585


Difference between string, string builder, and string buffer?

520


What advantage do java's layout managers provide over traditional windowing systems?

539






If a variable is declared as private, where may the variable be accessed?

546


Explain public static void main(string args[]).

562


What is externalizable?

609


What is the maximum size of hashmap in java?

525


How to overcome the exception object reference not set to an instance of object?

616


What are the advantages of exception handling?

549


How to check if linked list contains loop in java?

453


What is advantage of java?

536


What is the difference between jdk, jre, and jvm?

566


What is nan in java?

514