Results 1 to 7 of 7
Like Tree1Likes
  • 1 Post By kjkrum

Thread: Variable integers

  1. #1
    fishfryer is offline Member
    Join Date
    May 2013
    Posts
    4
    Rep Power
    0

    Default Variable integers

    I am new to this website and have tried to find without success whether it is possible to declare a variable integer that is accessible through out my project. This would seem to be most desirable but I don't seem to be able to put it into practice.
    Viv

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,798
    Rep Power
    19

    Default Re: Variable integers

    Global variables are a Bad Thing in Java.
    Global constants are OK.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    fishfryer is offline Member
    Join Date
    May 2013
    Posts
    4
    Rep Power
    0

    Default Re: Variable integers

    Why
    Viv

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,798
    Rep Power
    19

    Default Re: Variable integers

    Because you'll never know which bit of code has changed the variable.
    Why do you think you need one?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #5
    fishfryer is offline Member
    Join Date
    May 2013
    Posts
    4
    Rep Power
    0

    Default Re: Variable integers

    I am using a variable over several activities and have transferred the variable with "intents" but this seems inefficient, time wasting and uses memory that could be better employed. If I needed to know which bit of code changed the variable I'd sure I could sort it out.
    Viv

  6. #6
    fishfryer is offline Member
    Join Date
    May 2013
    Posts
    4
    Rep Power
    0

    Default Re: Variable integers

    I am using a variable over several activities and have transferred the variable with "intents" but this seems inefficient, time wasting and uses memory that could be better employed. If I needed to know which bit of code changed the variable I'd sure I could sort it out.
    Viv

  7. #7
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default Re: Variable integers

    Worrying about tiny inefficiencies only leads to madness.
    DarrylBurke likes this.
    Get in the habit of using standard Java naming conventions!

Similar Threads

  1. Replies: 2
    Last Post: 01-09-2013, 08:10 PM
  2. How to compare variable with multiple variable?
    By mharckz009 in forum New To Java
    Replies: 5
    Last Post: 09-11-2012, 04:33 PM
  3. Dynamic variable name based on other variable
    By nadissen in forum Eclipse
    Replies: 4
    Last Post: 05-06-2011, 06:22 PM
  4. Replies: 11
    Last Post: 07-07-2010, 06:02 AM
  5. Set of Integers
    By rsjava24 in forum New To Java
    Replies: 7
    Last Post: 01-28-2010, 10:29 AM

Posting Permissions

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