Write a generic class called “MyFour”. It should use a type parameter of “T”. It should have four fields, item1, item2, item3, item4, all of type T.

Write a generic class called “MyFour”. It should use a type parameterof “T”. It should have four fields, item1, item2, item3, item4, all oftype T. Its constructor receives values for setting all four items. Itshould have a method “allEqual” that returns true if all four items areequal according to their “equals” method. It should have a method called”shiftLeft” that shifts all items up one position, and puts the firstitem’s value into the last item. For example, if list has 1, 2, 3, 4, then after shiftLeft, it is 2, 3, 4, 1.It should have a “toString” method that returns a String of the items in this format: (item1, item2, item3, item4).Finally, add a “main” method. First it should create a MyFour object of type String, passing it four identical strings. Print the object, thencall and print the results of “allEqual”. Next, create an object of fourdifferent Integers. Again print the object and print the results of “allEqual”. After that, shift the items left using your method, and print them again.public class MyFour<T> {privateprivateprivateprivate TTTT item1;item2;item3;item4; /***** @param item1* @param item2* @param item3* @param item4*/public MyFour(T item1, T…
homeworkhelplocal
Calculate your essay price
(550 words)

Approximate price: $22

How it Works

1

It only takes a couple of minutes to fill in your details, select the type of paper you need (essay, term paper, etc.), give us all necessary information regarding your assignment.

2

Once we receive your request, one of our customer support representatives will contact you within 24 hours with more specific information about how much it'll cost for this particular project.

3

After receiving payment confirmation via PayPal or credit card – we begin working on your detailed outline, which is based on the requirements given by yourself upon ordering.

4

Once approved, your order is complete and will be emailed directly to the email address provided before payment was made!