Thread: Local variable Stat, Local variable lvl

Results 1 to 6 of 6
  1. #1 Local variable Stat, Local variable lvl 
    Registered Member

    Join Date
    Oct 2009
    Posts
    115
    Thanks given
    3
    Thanks received
    5
    Rep Power
    105
    Never encountered this before. I got this while applying Grahams event manager.

    Compiler Output:

    Code:
    Client.java:727: Local variable stat is accessed from within inner class and needs to be declared final
    sendMessage("Congratulations, you just advanced your "+Stat+" level to "+playerLevel[lvl]+".");
    
    Client.java:727: Local variable stat is accessed from within inner class and needs to be declared final
    sendMessage("Congratulations, you just advanced your "+Stat+" level to "+playerLevel[lvl]+".");
    It's late and I was hoping to finish this up and go to bed. Anybody know where I can declare these final?
    Reply With Quote  
     

  2. #2  
    Registered Member
    Sora's Avatar
    Join Date
    Jul 2008
    Age
    25
    Posts
    644
    Thanks given
    18
    Thanks received
    39
    Rep Power
    128
    turn the stat method to public final.

    Eg:
    Code:
     public final String whatever = "whatever";
    Declare it in your main class.
    Reply With Quote  
     

  3. #3  
    Registered Member

    Join Date
    Oct 2009
    Posts
    115
    Thanks given
    3
    Thanks received
    5
    Rep Power
    105
    Quote Originally Posted by 'Sora' View Post
    turn the stat method to public final.

    Eg:
    Code:
     public final String whatever = "whatever";
    Declare it in your main class.
    What should the second "whatever" be?
    Reply With Quote  
     

  4. #4  
    Jewish Squid
    Guest
    Find
    Code:
    String stat
    remove all the text before it on that line, add this to before String stat
    Code:
    public final
    Reply With Quote  
     

  5. #5  
    Registered Member

    Join Date
    Sep 2008
    Posts
    2,219
    Thanks given
    148
    Thanks received
    204
    Rep Power
    1570
    Make the variables final, just add 'final' in front of the variable type.

    [Only registered and activated users can see links. ]

    Reply With Quote  
     

  6. #6  
    Registered Member

    Join Date
    Oct 2009
    Posts
    115
    Thanks given
    3
    Thanks received
    5
    Rep Power
    105
    Thanks for the help you guys. It turns out string Stat was never declared at all, but it was named string statName .

    I'm still having trouble locating string playerLevel though . Also the full variable is playerLevel[lvl].
    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
  •