Thread: tempSave ERROR WHEN COMPILING

Results 1 to 3 of 3
  1. #1 tempSave ERROR WHEN COMPILING 
    Ryann
    Guest
    umm i don't understand why when i try to use tempSave in a second boolean to save playerdata it doesnt work. I used it in the boolean above to save "username".dat but it wont work when making "username".txt. i get this error when compiling

    PlayerSave.java:82: cannot find symbol
    symbol : variable tempSave
    location: class PlayerSave
    ObjectOutputStream out = new ObjectOutputStream(new FileOutputSt
    ream("./character/"+tempSave.playerName+".txt"));

    ^
    PlayerSave.java:83: cannot find symbol
    symbol : variable tempSave
    location: class PlayerSave
    out.writeObject((PlayerSave)tempSave);
    ^
    Note: stream.java uses or overrides a deprecated API.
    Note: Recompile with -Xlinteprecation for details.
    2 errors
    Press any key to continue . . .
    and btw heres the working boolean:
    private boolean saveGame(Player plr)
    {
    PlayerSave tempSave = new PlayerSave(plr);
    try
    {
    ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream("./savedGames/"+tempSave.playerName+".dat"));
    out.writeObject((PlayerSave)tempSave);
    out.close();
    /*
    ObjectOutputStream out = new ObjectOutputStream( new FileOutputStream("./character/"+tempSave.playerName+".txt"));
    out.writeObject((PlayerSave)tempSave);
    out.close();*/
    }
    catch(Exception e){
    return false;
    }
    return true;
    }
    and the nonworking boolean:
    private boolean savedGameAccesible (Player plr)
    {
    PlayerSave tempsave = new PlayerSave(plr);
    try
    {
    ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream("./character/"+tempSave.playerName+".txt"));
    out.writeObject((PlayerSave)tempSave);
    out.close();
    }
    catch(Exception e){
    return false;
    }
    return true;
    }


    }
    Help would be GREATLY appreaciated
    and of course,
    repp++
    Reply With Quote  
     

  2. #2  
    Eren
    Guest
    I don't really know any Java but...But wouldnt the tempSave be tempsave or you could change this PlayerSave tempsave = new PlayerSave(plr); to this PlayerSave tempSave = new PlayerSave(plr);
    Reply With Quote  
     

  3. #3  
    Ryann
    Guest
    well it has to be tempSave with the capital 2 because java is case sensitive; the second word is started by making the firs letter capital.
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •