Java programming Write the skeleton of a generic class called MyList. MyList rep
ID: 3711436 • Letter: J
Question
Java programming
Write the skeleton of a generic class called MyList. MyList represents a list that can be created to hold elements of type String (or subclasses of String). MyList should have the following methods: add (takes an element as input, returns nothing), remove (takes an element as input, returns nothing), indexOf (takes an element as input, returns an integer index), get (takes an integer index as input, returns an element). The skeleton of the class should contain the class definition (ex: class Test {}) and the method definitions (ex: void testMethod(int testInput)). Writing the implementation for the methods is unnecessary.
Explanation / Answer
As you said you just want the skeleton, So I am posting the class without the implementation of the methods. Please let me know if you find any issue in this ..I'll helo for sure...
public class MyList1<T extends String> {
void add(T element)
{
}
void remove(T element)
{
}
int indexOf(T element)
{
}
T get(int index)
{
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.