Search:

Type: Posts; User: curmudgeon

Search: Search took 0.21 seconds.

  1. Re: Help writing to a file getting an exception error

    It depends. If this is for a homework assignment, and your work is now complete, then perhaps what you've done is enough, but going forward with new projects I would certainly do this. Again, if I...
  2. Re: Help writing to a file getting an exception error

    Wonderful! Glad you've got it solved!
  3. Re: Help writing to a file getting an exception error

    You're welcome, and best of luck!
  4. Re: Help writing to a file getting an exception error

    Again, this method should not be part of the Player class but rather some utility class that has a readPlayer(String name) method, and that returns either a Player object if the file is found or null...
  5. Re: Help writing to a file getting an exception error

    The question is what is the purpose of the readFile()? Is to simply print out what is held in the file, to just display it? Or is it to convert the data held into Player objects? Because if the...
  6. Re: Help writing to a file getting an exception error

    But where do you save this data as I don't see it in the readFile() method that you've posted? And besides, the Player information should be saved as a Player object, not Strings, right?
  7. Re: Help writing to a file getting an exception error

    I'm not sure either because your code is going every which way but loose. For instance when you read the Player data in in the readFile() method, where do you save it to a variable that is available...
  8. Re: Help writing to a file getting an exception error

    Your code confuses me quite a bit, and part of it is because of your god-class, Player, since it seems full of lots of code that has little to do with the essence of being a Player object. I think...
  9. Re: Help writing to a file getting an exception error

    OK, let me look at the rest of your code in greater depth...
  10. Re: Help writing to a file getting an exception error

    Again, you're closing your scanner inside of your while loop. Note that the while loop begins on the line with the while ( ... ) { and ends at the matching closing brace, }:



    while...
  11. Re: Help writing to a file getting an exception error

    If you've made this attempt, you should show the code. For we know you still could be trying to close the Scanner inside of the for loop (after the System.out.println but before the closing brace),...
  12. Re: Help writing to a file getting an exception error

    Regarding:


    while (sn.hasNext()) {
    String a = sn.next();
    String b = sn.next();
    sn.close();
    System.out.print("Hi"+" "+a+"\n"+"In your...
  13. Re: Help writing to a file getting an exception error

    Please attempt to format your code so that we can read it. It's difficult trying to understand someone else's code, why make it more harder than it has to be?

    I usually use
Results 1 to 13 of 13