Answered step by step
Verified Expert Solution
Question
1 Approved Answer
MyStringMain: public class MyStringMain { public static void main(String[] args) { char[] MyInput = new char[50]; char[] MyInput2 = new char[50]; MyInput[0] = 'S'; MyInput[1]
MyStringMain:
public class MyStringMain { public static void main(String[] args) { char[] MyInput = new char[50]; char[] MyInput2 = new char[50]; MyInput[0] = 'S'; MyInput[1] = 't'; MyInput[2] = 'e'; MyInput[3] = 'v'; MyInput[4] = 'e'; MyInput[5] = ' '; MyInput[6] = '#'; MyInput2[0] = 'C'; MyInput2[1] = 'o'; MyInput2[2] = 's'; MyInput2[3] = 'a'; MyInput2[4] = 'r'; MyInput2[5] = 'e'; MyInput2[6] = 's'; MyInput2[7] = '#'; MyString S1 = new MyString(MyInput); MyString S2 = new MyString(MyInput2); MyString S3 = S1.concat(S2); display(S3); } static void display(MyString S) { for(int i=0; i
MyString:
public class MyString { public static final int MAXSIZE=50; public static final char DELIM = '#'; public MyString() { length=0; sArray = new char[MAXSIZE]; } public MyString(char[] inChars) { MyString(); while (inChars[length] != DELIM && length =length) return DELIM; else return sArray[loc]; } public MyString concat(MyString S) { MyString newS = new MyString(); for (int i=0; i4. Write the method for your version of MyString: boolean compare To(MyString other)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started