but I dont know the length of the string array and so when I enter the array at the command prompt then I need to split the coursegrades to course and grade. I have seen the string API but did not know which one to use. Can you please explain clearly.
Joined: Mar 05, 2009
In that case you can use method suggested by Maneesh. Retrieve "grade" as last character of string "cousergrade".
You don't need to split the array at all. You can obtain the individual array elements using the index or an Iterator.
An individual array element in your case is a String.
Again check the String API for a method which will give you the length. The use my earlier suggestion to obtain the last character in the String.
Note: indexes start with 0 and not 1
In case you run into problems, post your code.
subject: String array -- how to split a string array based on a delimiter