how and when compiler knows that the Java code throws the
checked Exception.

Answer Posted / vatsal doshi

When: At Compile Time

How: Complicated.

Checked Exceptions are those which a Java Compiler is capable of checking at compile time. These exceptions normally occur when some pre-definite methods from the Java API are used by programmer. So compiler identifies such method invocations in the code. If handled using catch, or specified in the throws clause, compiler compiles successfully. Otherwise, it shows a Compile Time Error Message of possibility of a Checked Exception

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is variable argument in java?

766


Can a static method be final?

755


How do you reverse a string in java without using string buffer?

808


What is a variable declaration?

745


What is token in java?

762


What is a stack class in java ?

835


What do u mean by variable?

784


What happens if an exception is throws from an object's destructor?

786


Why pass by reference is not possible in java?

703


What is difference between equals and hashcode method?

760


What are different types of multitasking?

717


Is java code slower than native code?

756


Why is java called java?

780


What are thread priorities and importance of thread priorities in java?

812


Explain notify() method of object class ?

847