Can someone close this it's solved.
Type: Posts; User: loui345
Can someone close this it's solved.
Even though it is solved, do you think i should still rewrite the code and make it like you suggested? It seems like a lot of extra work, but do you think it will pay dividends in the future?
It worked... I had to many scanners opening and not closing.
Thank you, Thank you, and Thank you.
Yes, the problem is with the readFile() method. All the other code works perfectly. I am unsure on how to read data and store the data into variables. I thought the scanner method could achieve that...
I am sorry, i misunderstood you. My intentions was to read the text file store the information into variables, which then would allow me to manipulate the data. That what I thought you was asking...
Yes, I saved the data to into Strings using the scanner next method, which seems to work.
Okay, great I totally understand your logic, but if i still clean the code up I still don't understand where I went wrong with scanner method. It works as long as the close is in the while loop.
...
Yes,
I understand the point you're trying to make, but if I close the scanner outside of the while loop the program will not write to the text file. I end up with a blank text file. Leaving my...
public class Player {
private int wonAGame;
private int lostAGame;
private int addMoney;
private static String fPlayer;
Scanner sn = new Scanner(System.in);
public...
So it appears, I can continue on with the program logic and continue on with game, keep passing the error to other methods, and each method ducks the error, but inevitability it will throw the...
Yes, that makes perfect sense to close the scanner after the loop is done accessing the variables, but I have tried to close the scanner after the System.out.print and still to no avail. For example,...
I am having trouble closing the scanner
Hello,
I have gotten my program to work and do what I desire, but I still am getting java.lang.illegalStateException: Scanner closed error. The program is doing what it is suppose to be doing, but...
Now I got the problem to work following newbie's advice. I just would like to know where my thinking went bad, so in the future I won't make this mistake, and possibly I can apply this logic to...
I got it work thanks newbie. SO my problem was that I had many objects of the same class. I should of just created a new object to write to the file?
made a mistake on tags, can someone instruct me again on how to do tags
I have program i am trying to do. I was successful in checking to see if the file was created and if it was not created then creating it. Now I want to actually put data it the file and i am getting...