Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Program 1 displays false and Program 2 displays false what is the output of the

ID: 3839359 • Letter: P

Question

Program 1 displays false and Program 2 displays false what is the output of the following code? ArrayList list = new ArrayList(); Java util Date d = new Java util Date(); list.add(d); listadd(d). System outprint in((list get(0) -list get(1)) + " * + (list get(0)).equals(list get(1))); A. true false B. false true r C. true true D. false false Which of the following statements are true? A. You can always pass an instance of a subclass to a parameter of its super class type. This feature is known as polymorphism. B. The compiler finds a matching method according to parameter type, number of parameters, and order of the parameters at compilation time. C. A method may be implemented in several subclasses. The Java Virtual Machine dynamically binds the implementation of the method at runtime. D. Dynamic binding can apply to static methods. E. Dynamic binding can apply to instance methods. A class design requires that a particular member variable must be accessible by any subclasses of this class, but otherwise not by classes which are not members of the same package. what should be done to achieve this? A. The variable should be marked public. B. The variable should be marked private. C. The variable should be marked protected. D. The variable should have no special access modifier. E. The variable should be marked private and an access or method provided. Polymorphism means___. A. that data fields should be declared private B. that a class can extend another class C. that a variable of super type can refer to a subtype object D. that a class can contain another class

Explanation / Answer

Q41.
   Since we are adding same object of Date in ArrayList,
   So they both points to same Object in memory,
   Hence == (reference comparison) and equals() methos (content comparison) returns true

   Ans. C. true true

Q42.
   Ans. A, B, C, E

Q43.
   Ans. C.The variable should be marked protected

   Since it should be accessible to any subcasses(subclass in same or different package), it should be protected

Q44.
   Ans C. that a class can efer to a subtype object

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote