Results are out! Find what you need...fast. Get quick advice or join the chat
Hey there! Sign in to join this conversationNew here? Join for free

How do I rename a variable (NetBeans)

Announcements Posted on
Don't forget to check out our results day hub. See you on the day for celebration and support, good luck! 22-06-2015
Will you get the grades you need for uni? Get prepared today and de-stress, sign up to email alerts for course places! 02-06-2015
  1. Offline

    ReputationRep:
    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
  2. Offline

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

    ReputationRep:
    (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?
  4. Offline

    ReputationRep:
    (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?
  5. Offline

    ReputationRep:
    (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.
  6. Offline

    ReputationRep:
    Why do you need to store the same information twice?
  7. Offline

    ReputationRep:
    (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.
  8. Offline

    ReputationRep:
    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?
  2. this can't be left blank
    this email is already registered. Forgotten your password?
  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 to join now Processing…

Updated: July 15, 2012

Should there be more homework?

How much is too much?

Article updates
Useful resources
x

Think you'll be in clearing or adjustment?

Hear direct from unis that want to talk to you

Get email alerts for university course places that match your subjects and grades. Just let us know what you're studying.

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