61. How to use environment properties in the class?
62. What will be the output of the following Java program?
class Output
{
public static void main(String args[])
{
String str = "true false";
boolean x = Boolean.parseBoolean(str);
System.out.print(x);
}
}
class Output
{
public static void main(String args[])
{
String str = "true false";
boolean x = Boolean.parseBoolean(str);
System.out.print(x);
}
}
63. What will be the output of the following Java code?
import java.io.*;
class files
{
public static void main(String args[])
{
File obj = new File("/java/system");
System.out.print(obj.getName());
}
}
import java.io.*;
class files
{
public static void main(String args[])
{
File obj = new File("/java/system");
System.out.print(obj.getName());
}
}
64. Which of these is a super class of wrappers Byte and short wrappers?
65. What will be the output of the following Java program?
class exception_handling
{
public static void main(String args[])
{
try
{
int a = 1;
int b = 10 / a;
try
{
if (a == 1)
a = a / a - a;
if (a == 2)
{
int c[] = {1};
c[8] = 9;
}
finally
{
System.out.print("A");
}
}
catch (NullPointerException e)
{
System.out.println("B");
}
}
}
class exception_handling
{
public static void main(String args[])
{
try
{
int a = 1;
int b = 10 / a;
try
{
if (a == 1)
a = a / a - a;
if (a == 2)
{
int c[] = {1};
c[8] = 9;
}
finally
{
System.out.print("A");
}
}
catch (NullPointerException e)
{
System.out.println("B");
}
}
}
66. Which of these access specifiers can be used for an interface?
67. What will be the output of the following Java program?
import java.lang.reflect.*;
class Additional_packages
{
public static void main(String args[])
{
try
{
Class c = Class.forName("java.awt.Dimension");
Constructor constructors[] = c.getConstructors();
for (int i = 0; i < constructors.length; i++)
System.out.println(constructors[i]);
}
catch (Exception e)
{
System.out.print("Exception");
}
}
}
import java.lang.reflect.*;
class Additional_packages
{
public static void main(String args[])
{
try
{
Class c = Class.forName("java.awt.Dimension");
Constructor constructors[] = c.getConstructors();
for (int i = 0; i < constructors.length; i++)
System.out.println(constructors[i]);
}
catch (Exception e)
{
System.out.print("Exception");
}
}
}
68. Which of the following package stores all the standard java classes?
69. What type of methods an interface contain by default?
70. Which of these exceptions is thrown by compareTo() method defined in a double wrapper?
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.