61. How many bits are used for generating random numbers?
62. What will be the output of the following Java program?
class Output
{
public static void main(String args[])
{
char a[] = {'a', '5', 'A', ' '};
System.out.print(Character.isDigit(a[0])+ " ");
System.out.print(Character.isWhitespace(a[3])+ " ");
System.out.print(Character.isUpperCase(a[2]));
}
}
class Output
{
public static void main(String args[])
{
char a[] = {'a', '5', 'A', ' '};
System.out.print(Character.isDigit(a[0])+ " ");
System.out.print(Character.isWhitespace(a[3])+ " ");
System.out.print(Character.isUpperCase(a[2]));
}
}
63. Which of these methods is called when observed object has changed?
64. Which of these class allows us to get real time data about private and protected member of a class?
65. Which of the following is not a memory classification in java?
66. What will be the output of the following Java program?
public class BoxDemo
{
public static <U> void addBox(U u,
java.util.List<Box<U>> boxes)
{
Box<U> box = new Box<>();
box.set(u);
boxes.add(box);
}
public static <U> void outputBoxes(java.util.List<Box<U>> boxes)
{
int counter = 0;
for (Box<U> box: boxes)
{
U boxContents = box.get();
System.out.println("Box #" + counter + " contains [" + boxContents.toString() + "]");
counter++;
}
}
public static void main(String[] args)
{
java.util.ArrayList<Box<Integer>> listOfIntegerBoxes = new java.util.ArrayList<>();
BoxDemo.<Integer>addBox(Integer.valueOf(10), listOfIntegerBoxes);
BoxDemo.outputBoxes(listOfIntegerBoxes);
}
}
public class BoxDemo
{
public static <U> void addBox(U u,
java.util.List<Box<U>> boxes)
{
Box<U> box = new Box<>();
box.set(u);
boxes.add(box);
}
public static <U> void outputBoxes(java.util.List<Box<U>> boxes)
{
int counter = 0;
for (Box<U> box: boxes)
{
U boxContents = box.get();
System.out.println("Box #" + counter + " contains [" + boxContents.toString() + "]");
counter++;
}
}
public static void main(String[] args)
{
java.util.ArrayList<Box<Integer>> listOfIntegerBoxes = new java.util.ArrayList<>();
BoxDemo.<Integer>addBox(Integer.valueOf(10), listOfIntegerBoxes);
BoxDemo.outputBoxes(listOfIntegerBoxes);
}
}
67. What will be the output of the following Java program?
class X
{
int a;
double b;
}
class Y extends X
{
int c;
}
class Output
{
public static void main(String args[])
{
X a = new X();
Y b = new Y();
Class obj;
obj = b.getClass();
System.out.print(obj.getSuperclass());
}
}
class X
{
int a;
double b;
}
class Y extends X
{
int c;
}
class Output
{
public static void main(String args[])
{
X a = new X();
Y b = new Y();
Class obj;
obj = b.getClass();
System.out.print(obj.getSuperclass());
}
}
68. Which of these methods of Character wrapper can be used to obtain the char value contained in Character object.
69. Which class loader loads jar files from JDK directory?
70. What will be the output of the following Java code snippet?
int a = random.nextInt(15) + 1;
int a = random.nextInt(15) + 1;
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.