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 program?
class box
{
int width;
int height;
int length;
}
class mainclass
{
public static void main(String args[])
{
box obj = new box();
System.out.println(obj);
}
}

What will be the output of the following Java program?
class box
{
int width;
int height;
int length;
}
class mainclass
{
public static void main(String args[])
{
box obj = new box();
System.out.println(obj);
}
}
a) 0
b) 1
c) Runtime error
d) classname@hashcode in hexadecimal form

Answer: d
Explanation: When we print object internally toString() will be called to return string into this format classname@hashcode in hexadecimal form.

Join The Discussion