I am stuck on the output.
Norm Radder wrote:
I am stuck on the output.
Please explain what the problem is.
Post the current output, add some comments saying what is wrong with it and show what you want the output to be.
Could I do this:
Norm Radder wrote:
Could I do this:
Did you try it?
What happened?
Getting an unreachable statement.
Norm Radder wrote:
Getting an unreachable statement.
Please post the full text of the error message showing Where the unreachable statement is. For example:
Norm Radder wrote:Any code after a return statement is not reachable. A return statement causes the execution in a method to end.
Move the code after the return to somewhere before the return statement.
Note: Images are hard to work with. Text can not be copied from an image to include in a response.
right?
I'm not sure what you're trying to do here. You have no 'builder' class so you can't do 'new builder()'. You've already used Java's StringBuilder class correctly in your code so why aren't you doing the same thing here. You won't have spaces between your words here, though, so you could modify it like this.David Vorpe wrote:
Norm Radder wrote:
right?
Try it and see what happens.
Norm Radder wrote:Sorry you had problems. It's hard to make suggestions when only bits and pieces of code are posted that are out of context.
If would be better if instead of asking "what will this do" that you actually do it and then copy the full text of any error messages and paste them here so we have something concrete to work with.
Good luck.
David Vorpe wrote:
Norm Radder wrote:Sorry you had problems. It's hard to make suggestions when only bits and pieces of code are posted that are out of context.
If would be better if instead of asking "what will this do" that you actually do it and then copy the full text of any error messages and paste them here so we have something concrete to work with.
Good luck.
This is just a class outside of a main. I don't know how to call it in the main (another issue, I know), so I cannot give you output because the code will not run outside of the Main.
Carey Brown wrote:
Do you have a class called "Main" ? Any other classes involved? If so, could you post all of your code, including Main and whatever?
David Vorpe wrote:
Carey Brown wrote:Java does not have aa "><=" operator. If you meant "not equals", then that is "!=". The exclamation point in Java means logical NOT.
doesn't recognize "randomSentence".
Norm Radder wrote:
doesn't recognize "randomSentence".
randomSentence is out of scope where it is referenced. It is defined inside of the loop's {}s and is not known outside of the {}s
What is the purpose of the loop? I don't see anything that is changing as the loop iterates.
There is nothing weird about it at all. Just a problem in the Ranch software somewhere which occasionally adds extraneous >s.David Vorpe wrote:
Carey Brown wrote:. . . Java does not have aa "><=" operator. . . .
That is weird. The code I have is:
Don't get me started about those stupid light bulbs. |