Question: please answer question (5 points) Below is the skeleton for a simplified StringBuilder class as done in the Closed Lab this semester. As in the
(5 points) Below is the skeleton for a simplified StringBuilder class as done in the Closed Lab this semester. As in the lab, the class has an ArrayList of Character to hold the individual characters of the StringBuilder object. Write the instance method indexOf as given below that returns the index of the first occurrence of the character c in the SimplestringBuilder. If there is no index for that character (i.e. the character is not in the String represented by the SimplestringBuilder 4. object) then the method must return -1. public class SimpleStringBuilder ( * A private member variable used to hold the internal state of the * SimplestringBuilder. This ArrayList holds the characters of the * String that will be built. So the String "Hello" would be represented by an ArrayList containing the characters private ArrayList
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
