81. Which of these method can set the out stream to OutputStream?
82. Which of the following constant are defined in Boolean wrapper?
83. Which of these type parameters is used for a generic class to return and accept any type of object?
84. What will be the output of the following Java program?
import java.util.*;
public class genericstack
{
Stack stk = new Stack ();
public void push(E obj)
{
stk.push(obj);
}
public E pop()
{
E obj = stk.pop();
return obj;
}
}
class Output
{
public static void main(String args[])
{
genericstack gs = new genericstack();
gs.push("Hello");
System.out.print(gs.pop() + " ");
genericstack gs = new genericstack();
gs.push(36);
System.out.println(gs.pop());
}
}
import java.util.*;
public class genericstack
{
Stack stk = new Stack ();
public void push(E obj)
{
stk.push(obj);
}
public E pop()
{
E obj = stk.pop();
return obj;
}
}
class Output
{
public static void main(String args[])
{
genericstack gs = new genericstack();
gs.push("Hello");
System.out.print(gs.pop() + " ");
genericstack gs = new genericstack();
gs.push(36);
System.out.println(gs.pop());
}
}
85. What will be the output of the following Java code?
class Output
{
public static void main(String args[])
{
Double i = new Double(257.5);
boolean x = i.isNaN();
System.out.print(x);
}
}
class Output
{
public static void main(String args[])
{
Double i = new Double(257.5);
boolean x = i.isNaN();
System.out.print(x);
}
}
86. What will be the output of the following Java code?
class isNaN_output
{
public static void main(String args[])
{
Double d = new Double(1 / 0.);
boolean x = d.isNaN();
System.out.print(x);
}
}
class isNaN_output
{
public static void main(String args[])
{
Double d = new Double(1 / 0.);
boolean x = d.isNaN();
System.out.print(x);
}
}
87. What is the range of numbers returned by Math.random() method?
88. What will be the output of the following Java program?
package pkg;
class display
{
int x;
void show()
{
if (x > 1)
System.out.print(x + " ");
}
}
class packages
{
public static void main(String args[])
{
display[] arr=new display[3];
for(int i=0;i<3;i++)
arr[i]=new display();
arr[0].x = 0;
arr[1].x = 1;
arr[2].x = 2;
for (int i = 0; i < 3; ++i)
arr[i].show();
}
}
Note : packages.class file is in directory pkg;
package pkg;
class display
{
int x;
void show()
{
if (x > 1)
System.out.print(x + " ");
}
}
class packages
{
public static void main(String args[])
{
display[] arr=new display[3];
for(int i=0;i<3;i++)
arr[i]=new display();
arr[0].x = 0;
arr[1].x = 1;
arr[2].x = 2;
for (int i = 0; i < 3; ++i)
arr[i].show();
}
}
Note : packages.class file is in directory pkg;
89. What will be the output of the following Java program?
class Output
{
public static void main(String args[])
{
Double i = new Double(257.5);
Double x = i.MIN_VALUE;
System.out.print(x);
}
}
class Output
{
public static void main(String args[])
{
Double i = new Double(257.5);
Double x = i.MIN_VALUE;
System.out.print(x);
}
}
90. Which of these methods loads the specified dynamic library?
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.