Question: I need help with this Java question. Please provide an output to FancyArray.java if possible. Add the following two methods to the FancyArray> class: -
I need help with this Java question. Please provide an output to FancyArray.java if possible.

Add the following two methods to the FancyArray> class: - public int indexOf(E e): returns the index of the first occurrence of e in this FancyArray; if e does not occur in this FancyArray, returns -1. - public int lastIndexOf(E e): returns the index of the last occurrence of e in this FancyArray; if e does not occur in this FancyArray, returns -1. For example, if fa is a FancyArray representing [5,10,15,10,20], then: - fa.indexOf(10) should be 1 - fa.lastlndexOf(10) should be 3 - fa.indexOf(25) should be 1 - fa.lastlndexOf(25) should be 1 Note: If you wish, you can make the parameter type be Object instead of E. It doesn't really matter for this exercise. Note: do not use ArrayList (or any other kind of List or Collection) in the FancyArray class. Additional Notes: Regarding your code's standard output, CodeLab will check for case errors but will ignore whitespace (tabs, spaces, newlines) altogether
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
