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 method with example?

665


Define canvas?

639


Explain about class in java?

713


What is the disadvantage of java?

588


What is string :: npos?

674






Can you access non static variable in static context?

655


What is this () in java?

664


What is an example of a boolean?

670


What is the arraylist in java?

623


What are the types of exceptions?

676


What is the difference between notify and notifyall method?

711


What is hashmap and map?

628


I want to print “hello” even before main is executed. How will you acheive that?

761


Can we create an object if a class doesn't have any constructor ( not even the default provided by constructor ) ?

645


How do I convert a numeric ip address like 192.18.97.39 into a hostname like java.sun.com?

690