Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

What will be the output of the following Java code?
class Output
{
public static void main(String args[])
{
Double i = new Double(257.578);
int x = i.intValue();
System.out.print(x);
}
}

What will be the output of the following Java code?
class Output
{
public static void main(String args[])
{
Double i = new Double(257.578);
int x = i.intValue();
System.out.print(x);
}
}
a) 0
b) 1
c) 256
d) 257

Answer: d
Explanation: i.intValue() method returns the value of wrapper i as a Integer. i is 257.578 is double number when converted to an integer data type its value is 257.
Output:
257

Join The Discussion