You are on page 1of 1

{

public static void main(String args[])


{
B obj = new B();
obj.j=2;
obj.display();
}
}
a) 0
b) 2
c) Runtime Error
d) Compilation Error
Answer: b
7-What will be the output of the following Java program?

class A
{
int i;
int j;
A()
{
i = 1;
j = 2;
}
}
class Output
{
public static void main(String args[])
{
A obj1 = new A();
A obj2 = new A();
System.out.print(obj1.equals(obj2));
}
}
a) false
b) true
c) 1
d) Compilation Error
Answer: a
8-What will be the output of the following Java code?

class Output
{
public static void main(String args[])
{
Object obj = new Object();

You might also like