what is difference between throw and throws in exception?

Answer Posted / ravivarman

Throw keyword can be used by a program to throw exceptions
explicitly.the execution of the current block stops
immediately after the throw statement.
A method should declare that it can cause an exception and
expects its caller handle or re-throw the exception.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is an argument in java?

513


What is Java Shutdown Hook?

617


What is the formula to calculate percentage?

540


Can we override constructors?

546


Why java is called not pure object oriented language?

582






How do you implement tree mirroring in java?

597


Can a constructor call another constructor?

567


Is c better than java?

548


What are the major advantages of internal iteration over external iteration?

581


How many classes can any class inherit java?

512


What is an abstract class and what is it’s purpose?

541


How to check if linked list contains loop in java?

461


What are the important features of Java 9 release?

538


What is oop principle in java?

553


What happens if I remove static from main method?

531