Question: The String dass is provided in the Java library. Provide your own implementation for the following methods (name the new class MyString) DO NOT USE

The String dass is provided in the Java library. Provide your own implementation for the following methods (name the new class MyString) DO NOT USE THE STRING OBJECT AND ITS METHODS. IMPLEMENT THEM ALL AGAIN YOURSELF! 1 import java.util.*; 2 import java.lang.*; 3import java.io.*; You can use char[] and Character object. public MyString(charl] chars); public char charAt(int index); public int lengthO; public MyString substring(int begin, int end); public MyString toLowerCaseO; public boolean equals(MyString s); public static MyString valueOf(int i); public char] toCharsO; class MyString ( public MyString(char] chars)t public char charAt(int index)t 12 public int length)t public MyString substring(int begin, int end) public MyString toLowerCase)t 18 19 1 public boolean equals (MyString s) public static MyString valueOf (int i)t 24 25 public char[] toChars t 27 28 30 31 32 1 class DriverMaint public static void main(String[] args) MyString s1 = new MyString(new char[] {A', 'B', 'C')); System.out.println(s1.length)); System.out.println (s1.charAt (1)); MyString s2 s1.substring(0,2); System.out.println(s2.toLowerCase.equals (new MyString(new char[] f'a', char[] chars MyString.valueOf(345).toChars (); for (int i = 0; 1 chars.length; 1++) { 'b'))) System.out.print (chars[i]; 12
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
