adplus-dvertising
frame-decoration

Question

What is the output of this program?
    import java.util.*;
    class Arraylist 
    {
        public static void main(String args[])
        {
            ArrayList obj1 = new ArrayList();
            ArrayList obj2 = new ArrayList();
            obj1.add("A");
            obj1.add("B");
            obj2.add("A");
            obj2.add(1, "B");
            System.out.println(obj1.equals(obj2));
        }
    }

a.

0

b.

1

c.

true

d.

false

Posted under Java Programming

Answer: (c).true

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 interface declares core method that all collections will have?

Q. Which of these interface handle sequences?

Q. Which of this interface must contain a unique element?

Q. Which of these is a Basic interface that all other interface inherits?

Q. Which of these is static variable defined in Collections?

Q. Which class is used to generate random number?

Q. Which method is used to generate boolean random values in java?

Q. What is the return type of Math.random() method?

Q. Random is a final class?

Q. What is the range of numbers returned by Math.random() method?

Q. How many bits are used for generating random numbers?

Q. What would be the output of following code snippet?

int a = random.nextInt(15) + 1;

Q. What would be the output of following code snippet?

int a = random.nextInt(7) + 4;

Q. Math.random() guarantees uniqueness?

Q. What is the signature of Math.random() method?

Q. Which of these class produce objects with respect to geographical locations?

Q. Which of these methods is not a Locale class?

Q. Which of these class can generate pseudorandom numbers?

Q. Which of these method of Locale class can be used to obtain country of operation?

Q. Which of these is a method can generate a boolean output?