51. What will be the output of the following Java program?
class Output
{
public static void main(String args[])
{
double x = 3.1;
double y = 4.5;
double z = Math.max( x, y );
System.out.print(z);
}
}
class Output
{
public static void main(String args[])
{
double x = 3.1;
double y = 4.5;
double z = Math.max( x, y );
System.out.print(z);
}
}
52. What will be the output of the following Java code?
class Output
{
public static void main(String args[])
{
Double i = new Double(257.578123456789);
float x = i.floatValue();
System.out.print(x);
}
}
class Output
{
public static void main(String args[])
{
Double i = new Double(257.578123456789);
float x = i.floatValue();
System.out.print(x);
}
}
53. What is the return type of Math.random() method?
54. What is the value of "d" in the following Java code snippet?
double d = Math.round ( 2.5 + Math.random() );
double d = Math.round ( 2.5 + Math.random() );
55. Which of these is an correct way of defining generic class?
56. Which of the following is the correct way of implementing an interface A by class B?
57. Where is String Pool stored?
58. What will be the output of the following Java program?
class exception_handling
{
static void throwexception() throws ArithmeticException
{
System.out.print("0");
throw new ArithmeticException ("Exception");
}
public static void main(String args[])
{
try
{
throwexception();
}
catch (ArithmeticException e)
{
System.out.println("A");
}
}
}
class exception_handling
{
static void throwexception() throws ArithmeticException
{
System.out.print("0");
throw new ArithmeticException ("Exception");
}
public static void main(String args[])
{
try
{
throwexception();
}
catch (ArithmeticException e)
{
System.out.println("A");
}
}
}
59. Which of these keywords is used by a class to use an interface defined previously?
60. Classes and Methods are stored in which space?
Read More Section(Interfaces and Abstract Classes)
Each Section contains maximum 100 MCQs question on Interfaces and Abstract Classes. To get more questions visit other sections.