ok i cannot do an array in my program! so is there any other way i can return more that one string in my if's statements. Also, i keep getting the following error message againg with each if statement (unreachable statement) i made the if statement print out the word then return it and it still is giving this error. so i dont know what to do
Part of the problem seems to be formatting. Take a look at this code (better formatted), and the "unreachable statement" error becomesw clearer:
In line A you create an "if" In line B you return. In line C you create an else for your if. IN line D you return within the else. At this point, you have either returned at line B or you have returned at line D. Anything Line E and beyond is "unreachable"; there is no logical way to get to this code. Why are you asking about returning multiple values? This code does not seem to reflect that need. Arrays are, of course, the easiest way to do that, but if your professor does not want you to return arrays, you might consider using output parameters. Unfortunately, the easiest way to implement output parameters in Java is with an array....although you could use a List.
Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
My, my, aren't you a big fella. Here, have a tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth