Question: In this assignment you will implement your own version of the String class in Java, named MyString. The class will have just one public attribute

In this assignment you will implement your own version of the String class in Java, named MyString. The class will have just one public attribute charArray of type character array

In this assignment you will implement your own version of the String

The class will have the following methods: Mystring (String s) a constructor that takes as input parameter a String MyString (char [1 array) a constructor that takes as input a character array. public int length() returns the length of the string public boolean isEmpty() r true if the length of the string is 0. eturns public Mystring substring(int start, int end) returns a new object of the class MyString that is a substring of the current string public Mystring substring(int start) returns a new object of the class MyString that is a substring of the current string. public char charAt (int position) returns the character at the specified position public int indexof char character) returns the position of the first occurrence of the character or -1 if the character is not found public MyString replace (char oldChar, char newChar) returns a new object of the class MyString where each occurrence of oldCHar is replaced by newChar. DO NOT modify the original object In some of this methods, the input parameter can be outside the boundaries of the string. Check the value of the parameter and if it is outside the boundaries, throw ArrayIndexOutOfBoundsException Use the tester class to check if your code is working fine

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!