kaylasedgewick5112 kaylasedgewick5112
  • 22-06-2021
  • Computers and Technology
contestada

1. Write a generic method that compares its 2 arguments using the equals method and returns true if they are equal and false otherwise. Ensure that the name of your method includes your last name.

Respuesta :

sandlee09
sandlee09 sandlee09
  • 26-06-2021

Answer:

Explanation:

The following piece of code is written in Java. It creates the method as requested that takes in two generic objects and compares them using the .equals() built in Java method. This method will return True if the objects are identical or False if they are not. A test case is used in the code and the output can be seen in the attached image below.

   public static <T> boolean comparePerez(T a, T b) {

       return a.equals(b);

   }

Ver imagen sandlee09
Answer Link

Otras preguntas

Which of the following bodies of water is bounded on three sides by Australia and to the north by the Arafura Sea? A. The Southern Ocean B. The Coral Sea C. The
divide 25kg in the ratio 2:3:5
how does Australia have a connection to Britain
Rory spends 1/5 hour cleaning the table,3/10 hour washing dishes, and 4/5 hour reading a book. How many hours does she spend doing all these activities?
60/100 in simplest form
what effects did the enlightenment philosophers have on government and society?
Describe the forces on an object travelling at a constant speed?
What is the GCF of 32 and 56? A. 4 B. 8 C. 16 D. 32
Which power is exclusive to the Senate?
Hemingway's dialogue could be described as: _____. Select all that apply. brief flowery realistic stilted surrealistic