[go: up one dir, main page]

0% found this document useful (0 votes)
8 views1 page

0 - Javamcq Part1 10

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 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