What is the difference between throw and throws?
Answer Posted / senthil nathan
throws: If a method is not capable of handling the raised
exception and it wants the caller of the method to
handle the exception means then the method uses the
"throws" keyword... The exception raised here is
of System Exception not User Exception...
throw: If the method is capable of handling the exception
by using try&catch block then this method uses the
"throw" keyword.. It is also used to raise our own
exception.
Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
Can we have two methods in a class with the same name?
What are the types of web technologies?
Can we have a method name same as class name in java?
what is difference between equals and ==?
What is a native method in java programming?
What is a classloader in java?
Explain java coding standards for variables ?
Why main method is called first in java?
What is the difference between static class and normal class?
How many JVMs can run on a single machine and what is the meaning of Just-In-Time (JIT) compiler?
What is floor math?
What is the importance of main method in Java?
What do you understand by final value?
Why does java doesnt suuport unsigned values?
How to instantiate static nested classes in java?