I'm trying to write a method that returns the individual characters of a certain string. For example, is String s = "Adam" then c[0] = "A", c[1] = "d" and so on.
I'm not sure how to use a return statement to do this. Here is the method:
[ December 02, 2004: Message edited by: Adam Blais ]
You need a return statement at the end of your method to return the char array. Also you can eliminate the endloop int variable and just declare your for loop like this.
Thanks for the response. My problem is I don't know how to use a return statement to return an array. I thought is was return output[];, but that isn't working. What's the correct command to get this array returned? [ December 02, 2004: Message edited by: Adam Blais ]
I'm doing my next exercise, and I need to convert a character array to a string. When I try to use the method in BlueJ and enter the character array with {a, b, c}, it says that it cannot resolve variable a. If I put {"a", "b", "c"}, it says it found a string where a char was expected. How do I enter in an array?