Variable with upperCase letter

Hi All, a beginner's question: can we name a variable using a Capital letter? (for instance int Count; or int cOunt; or int cOuNy; or int co_Unt;) Thanks

Answers

  • edited March 2015 Answer ✓
    • The Java language itself allows names in UTF-16 AFAIK.
    • But convention rules dictate what is called "lowerCameCase" for variable & function names.
    • Classes (and interfaces) go w/ "CamelCase".
    • And constants (static final) use ALL_CAPS_WITH_UNDERLINE.
  • Answer ✓

    In short, yes, all your names are legal, but if you want your programs to be readable, try and follow the guide that GoToLoop gave... :-)

  • You could have answered this yourself by simply trying it out. What happened when you wrote a small example program that tested those variable names out?

    But like PhiLho said, you should follow the standard naming conventions. More info is available here: http://www.oracle.com/technetwork/java/codeconventions-135099.html

Sign In or Register to comment.