Interfaces And Abstract Classes - Study Mode
[#191] 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 = a.getClass()
System.out.print(obj.getName())
}
}
Correct Answer
(A) X
[#192] What will be the output of the following Java code? class isinfinite_output
{
public static void main(String args[])
{
Double d = new Double(1 / 0.)
boolean x = d.isInfinite()
System.out.print(x)
}
}
Correct Answer
(C) true
[#193] 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.isLocalClass())
}
}
Correct Answer
(D) false
[#194] What will be the output of the following Java program? class Output
{
public static void main(String args[])
{
Double i = new Double(257.578123456789)
float x = i.floatValue()
System.out.print(x)
}
}
Correct Answer
(C) 257.57812
[#195] What will be the output of the following Java program? import java.io.*
class Chararrayinput
{
public static void main(String[] args)
{
String obj = "abcdef"
int length = obj.length()
char c[] = new char[length]
obj.getChars(0, length, c, 0)
CharArrayReader input1 = new CharArrayReader(c)
CharArrayReader input2 = new CharArrayReader(c, 0, 3)
int i
try
{
while ((i = input2.read()) != -1)
{
System.out.print((char)i)
}
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace()
}
}
}
Correct Answer
(A) abc