Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Understanding Oracle APEX 5 Application Development

Authors: Edward Sciore

2nd Edition

1484209893, 9781484209899

Students also viewed these Databases questions