24. Program
//Find Simply which method gives Compile Time Error ?
For Ex:- Method test1 will not give Error ! Now check other.
class D
{
public static void main(String[] args)
{
//1
int test1()
{
try
{
//Something
}
catch(ArithmeticException ex)
{
}
finally
{
}
return 10;
}
//2
int test2()
{
try
{
//Something
}
catch(ArithmeticException ex)
{
}
finally
{
return 20;
}
}
//3
int test3()
{
try
{
//Something
}
catch(ArithmeticException ex)
{
}
finally
{
return 20;
}
return 100;
}
//4
int test4()
{
try
{
//Something
}
catch(ArithmeticException ex)
{
return 20;
}
finally
{
}
return 100;
}
//5
int test5()
{
try
{
//Something
return 30;
}
catch(ArithmeticException ex)
{
return 20;
}
finally
{
}
return 5;
}
//6
int test6()
{
try
{
//Something
return 100;
}
catch(ArithmeticException ex)
{
return 200;
}
finally
{
return 300;
}
return 50;
}