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

0 - Javamcq Part1 10

Uploaded by

Priyansh Gangani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views1 page

0 - Javamcq Part1 10

Uploaded by

Priyansh Gangani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
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