-
What is the output of this program?
class N
{
int K;
int L;
N()
{
K = 1;
L = 2;
}
}
public class Result
{
public static void main(String args[])
{
N object = new N();
System.out.print(object.toString());
}
}
-
- Compilation Error
- true
- false
- String associated with object
- None of these
Correct Option: D
toString() is method of class Object, since it is superclass of every class, every object has this method. toString() returns the string associated with the calling object.