-
What is the output of this program?
class N
{
int K;
int L;
N()
{
K = 3;
L = 5;
}
}
public class Result
{
public static void main(String args[])
{
N obj1 = new N();
N obj2 = new N();
System.out.print(obj1.equals(obj2));
}
}
-
- true false
- false
- true
- false true
- None of these
Correct Option: B
obj1 and obj2 are two different objects. equals() is a method of Object class, Since Object class is superclass of every class it is available to every object.
output: