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

x=5 2x+y=10 what would the coordinates be
Work out 3/4 - 1/6 Give the answer in the simplest form
explain why x+8=12 and 12-x=8 have the same solution ?
What did Jackson's unofficial cabinet become known as?.
A metalworker has a metal alloy that is 15% copper and another alloy that is 75% copper. How many kilograms of each alloy should the metal worker combine to cre
What fraction is equal to 9//11
what is the climax in the book miracle on 49th street
compare and contrast area and volume
One number is 4 less than 3 times a second number. If 3 more than two times the first number is decreased by two times the second, the result is 11. What are
What is Abraham known for? A. He wrote the first five books of the Old Testament. B. Historians believe that he led the Hebrew people out of Egypt C. Accor