Sunday, June 25, 2017

final in try catch


What is the output of this program ?

final String c;
try
{
c = "a";
}
catch (Exception e)
{
c = "a";
}

Answer : Compilation error because c has been already assigned value in try block 

No comments:

Post a Comment