message variable holds the same value
I am trying to learn a bit of java before jumping into a project so when i do i'll know or have an idea on how to handle some situations. I am working on receiving user input. Which won't serve too big of a purpose later on but i still am gonna learn how. I'm currently having trouble getting my message variable to clear after a message has been printed to the console. It holds the same value after i enter any type of text. Anyone know why?
32 Replies
⌛
This post has been reserved for your question.
Hey @DevLop games! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
Because in the loop you don't assign a new string value to the
message
variable.I need to reassign a value?
yes
I just tried and i get the same issue
Except the new value doesn't get recorded
perhaps you are doing it wrong
How am i supposed to do it then??
you have to assign it not in the condition
Where
before condition
At the start of the loop?
yes
close the scanner after the loop.
Why do i need to do that?
It's a bit better practice. To avoid memory leak for the scanner. when the application ends.
If you are using Eclipse or IntelliJ then you might see that scanner is underlined in yellow
I don't see yellow
too bad. Those IDEs can give you valuable information about the syntax

You mean the tool tip?
yea
I have that
Also i'm noticing the application is ending with code 130
Why is this?
I don't know. What editor are you using to wrote the code and to compile at running?
intellij community edition
Try to close scanner and check whether you get the same ending code.
I am closing it
ok
I don't know regarding 130. But the initial question is solved.
Soo can i get an explanation on what code 130 is? I cannot find anything explaining what it is exactly and what can cause it.
If your console outputs it, you can copy it and search with google. You can put a comma and write
IntelliJ console output
as wellCould you just tell me
Just tell me i'm not seeing any useful information here
If I will find it then ok
paste here what do you see in your console
Process finished with exit code 130
This is the only relevant thing
Have you pressed "Ctrl+C" to stop the program?
If yes then that's the reason.
otherwise if you type QUIT then it should end normally and exit code should be 0.
Post Closed
This post has been closed by <@769926604872613899>.