adplus-dvertising
frame-decoration

Question

What is the output of this 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

Posted under Java Programming

Answer: (a).false

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of this program?

Similar Questions

Discover Related MCQs

Q. Which of these keywords are used to define an abstract class?

Q. Which of these is not abstract?

Q. If a class inheriting an abstract class does not define all of its function then it will be known as?

Q. Which of these packages contains abstract keyword?

Q. Which of this keyword must be used to inherit a class?

Q. A class member declared protected becomes a member of subclass of which type?

Q. Which of these is correct way of inheriting class A by class B?

Q. What is not type of inheritance?

Q. Using which of the following, multiple inheritance in Java can be implemented?

Q. All classes in Java are inherited from which class?

Q. In order to restrict a variable of a class from inheriting to subclass, how variable should be declared?

Q. If super class and subclass have same variable name, which keyword should be used to use super class?

Q. Static members are not inherited to subclass.

Q. Which of the following is used for implementing inheritance through an interface?

Q. Which of the following is used for implementing inheritance through class?

Q. What would be the result if a class extends two interfaces and both have a method with same name and signature?

Q. Does Java support multiple level inheritance?

Q. Which of this keyword can be used in a subclass to call the constructor of superclass?

Q. What is the process of defining a method in a subclass having same name & type signature as a method in its superclass?

Q. Which of these keywords can be used to prevent Method overriding?