Results 1 to 4 of 4
  1. #1
    appoint_raj is offline Member
    Join Date
    Jan 2009
    Rep Power

    Question Variable Nomenclature

    why in programing language variable names whould start from underscore or alphabetes only and not from a number?

  2. #2
    agent_kiran is offline Member
    Join Date
    Jun 2009
    Rep Power

    Default Agent

    It's a naming convention defined by all the other language developers.

  3. #3
    Singing Boyo is offline Senior Member
    Join Date
    Mar 2009
    Rep Power


    It's an extremely rigid convention, and they cannot start with numbers for another reason... It's extremely difficult for a compiler to tell the difference if there is a number at the beginning of your variable name. Not so hard after that, but before the compiler knows that is is reading a variable, if you give it what looks like a numerical constant, it will be confused...
    If the above doesn't make sense to you, ignore it, but remember it - might be useful!
    And if you just randomly taught yourself to program, well... you're just like me!

  4. #4
    angryboy's Avatar
    angryboy is offline Senior Member
    Join Date
    Jan 2009
    Rep Power


    To add to what SB said, imagine you are expected to write a parser and is expected to categorize this into digits or variables:
    Java Code:
    int 123;
    // whatever code here
    123 = 999;
    That's a headache to work with isn't it.
    Get NotePad++ (free)

Similar Threads

  1. About static variable
    By MarkWilson in forum New To Java
    Replies: 5
    Last Post: 06-27-2008, 02:43 PM
  2. getting the value of variable
    By Lehane_9 in forum New To Java
    Replies: 2
    Last Post: 03-05-2008, 02:42 AM
  3. Getting variable value from a variable name
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 02-16-2008, 10:26 PM
  4. Variable issues!
    By Alex89 in forum New To Java
    Replies: 1
    Last Post: 11-07-2007, 08:51 PM
  5. Variable No. of Arguments
    By Gajesh Tripathi in forum New To Java
    Replies: 2
    Last Post: 10-31-2007, 03:50 PM

Posting Permissions

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