0

What is my error? (MyString)

public my string substring( int beginIndex){ char []substr= new char [ this.length () - beginIndex]; for (int i = beginIndex ; i <this.length () i++); { substr [i - beginIndex] = this.charAt (i); } return MyString (substr); }

25th Mar 2017, 1:40 AM
bobo
1 Answer
+ 3
Is the error you're getting "String cannot be converted to char[]" ? You can use the String.valueOf() method to convert it. so: public String subString(..){ ..... // other code here // remove your return return String.valueOf(substr); }
25th Mar 2017, 2:57 AM
Rrestoring faith
Rrestoring faith - avatar