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

Scientific research should begin with a:
Matter can exist in different phases or states. What are three common states of matter?
Which leader is accredited with transforming Cuba into a communist state? a. Fulgencio Batista c. Fidel Castro b. Che Guevara d. Lenin
How do you think that taking care of your sight and hearing now will benefit you in the future?
the wavelength of a wave is the distance between
Can someone look at the photo and answer 49 for me please?
Bubonic plague is a deadly infectious disease commonly spread by _____.
what is the answer to this question a bicyle rides 14 miles in 122 mins if she continues at this speed ,how long will it take to travel in 35 miles plzz answer
What do erosion mean?
After the formation of Israel on May 14, 1948, what was the reaction of surrounding Arab nations?