P

Priyanka Tomar • 35.28K Points
Coach

Q. What will be the output of the following Java code?
class Output
{
public static void main(String args[])
{
Double y = new Double(257.57812);
Double i = new Double(257.578123456789);
try
{
int x = i.compareTo(y);
System.out.print(x);
}
catch(ClassCastException e)
{
System.out.print("Exception");
}
}
}

  • (A) 0
  • (B) 1
  • (C) Exception
  • (D) None of the mentioned
  • Correct Answer - Option(B)
  • Views: 61
  • Filed under category JAVA

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.


Question analytics