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); }
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);
}