Dear Friends,
I have a difficulty in understanding in locating compile error,compliler objection,runtime exception being thrown and runtime error.
for example
public boolean testAns(
String ans,int n)
{
boolean rslt;
if(ans.eualsIgnoreCase("YES") && n>5)
rslt=true;
return rslt;
}
what will be the result of trying to compile class and execute the testAns method with inputs no and 5?
1)a runthime exception will be thrown in the testAns method
2)A result of false will be returned
3)a compiler error will prevent compilation
4)a result of true will be returned
here the answer is 3.But I just want to know how to find it exactly.How to differentiate between compile errors and runtime errors.?compile time exceptions and runtime exceptions?I am always confused finding the correct option.
thanks.
Preeth