how and when compiler knows that the Java code throws the
Answers were Sorted based on User's Feedback
Answer / aruna
Checked or caught exceptions are those exceptions that the
application programmer created a catch block to handle them.
while compiling, the java compiler make sure that all the
checked exceptions must be caught by the applicaion
programmer.Those exceptions are called the application or
business logic exceptions.
Inside the method body, there are calls to other methods;
the compiler looks at each of their method signature, what
exceptions they declared to throw. There are two
possibilities, either exceptions are caught inside the
caller-method by a try-catch block, or the caller declares
to throw the exception to its caller.
|Is This Answer Correct ?||18 Yes||4 No|
Answer / vatsal doshi
When: At Compile Time
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|
What happens when you invoke a thread’s interrupt method while it is sleeping or waiting?
What is an abstract class?
Why is string builder not thread safe?
What is the difference between final, finally and finalize() in java?
What are the main differences between the java platform and other platforms?
Can we override constructor in java?
What is constructor chaining and how is it achieved in java?
Are arrays immutable in java?
when to for abstract class and when to go for interface
What is multi level inheritance in java?
What is another word for methodology?
Why stringbuffer is faster than string?