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

How do you know if a value is nan?

680


What is the difference between inner class and nested class?

628


Explain the difference between private, public, package and protected in java?

687


What access modifiers can be used for methods?

655


What is method overloading and method overriding?

638






Explain a few methods of overloading best practices in java?

616


What is lexicographically smallest string?

688


Why do we need data serialization?

631


What are unchecked exceptions in java?

705


How do I stop concurrentmodificationexception?

617


1.IN CASE OF DYNAMIC METHOD DISPATCH WHY WE USE REFERENCE VARIABLE,WE CAN USE THE DIFFERENT DEFINED OBJECT DIRECTLY TO ACCESS THE DATA MEMBER AND MEMBER FUNCTION OF THAT RESPECTIVE CLASS?WHAT IS THE MAIN FUNCTION OF "REFERENCE VARIABLE" HERE?

4046


What are the four versions of java?

654


What is memory leak and how does java handle it?

598


What does @override mean?

618


What happens if a constructor is declared private?

627