How do I rename a variable (NetBeans)

TSR Movie Madness. Vote and debate in all of the group finals from now to Saturday evening! 15-07-2014

    Rep:
    Hi,

    I want to rename a variable (correct typo) in my project which I'm doing using NetBeans. The thing is I've already used the variable (with the typo) in other classes so changing it would make a big mess.

    Help please

    Rep:
    Select the variable, right click then go to Refactor>rename, should work fine...

    Rep:
    (Original post by iCiaran)
    Select the variable, right click then go to Refactor>rename, should work fine...
    I know that but will it change every appearance of the variable name to the new name even in other classes?

    Rep:
    (Original post by Prokaryotic_crap)
    I know that but will it change every appearance of the variable name to the new name even in other classes?
    It should, I haven't used NetBeans before so I can't say for certain, it should definitely do it in the class you select it in, you may have do it in each class though...

    On a side note, are you really using the exact same variable in multiple classes? Or just variables called the same thing?

    Rep:
    (Original post by iCiaran)
    It should, I haven't used NetBeans before so I can't say for certain, it should definitely do it in the class you select it in, you may have do it in each class though...
    I know it works when you do it on the class you select it from, I've done it before, but I don't know if it works on all classes that use the variable and I don't want to do it on every single class that uses it because my project is quite bug and complex with many classes.

    (Original post by iCiaran)
    On a side note, are you really using the exact same variable in multiple classes?
    yes, I'm using the exact variable in multiple classes.

    Rep:
    Why do you need to store the same information twice?

    Rep:
    (Original post by Planto)
    Why do you need to store the same information twice?
    I'm not?

    e.g. I have a variable x and getter and setter methods for it and I want to change x but other classes are using its setter and getter methods.

    Rep:
    Honestly, just go and refactor it in every class, there can't be that many and it would have been done hours ago if you did...

Reply

Submit reply

Register

Thanks for posting! You just need to create an account in order to submit the post
  1. this can't be left blank
    that username has been taken, please choose another Forgotten your password?

    this is what you'll be called on TSR

  2. this can't be left blank
    this email is already registered. Forgotten your password?

    never shared and never spammed

  3. this can't be left blank

    6 characters or longer with both numbers and letters is safer

  4. this can't be left empty
    your full birthday is required
  1. By joining you agree to our Ts and Cs, privacy policy and site rules

  2. Slide the button to the right to create your account

    Slide to join now Processing…

: July 15, 2012

Which unis are the poshest?

See what students perceive to be the classiest establishments in Britain

Reputation gems:
You get these gems as you gain rep from other members for making good contributions and giving helpful advice.