Friday, October 11, 2013

Variables


Insurance Loans Mortgage Attorney Credit Lawyer Donate Degree Hosting Claim Conference Call Trading Software Recovery Transfer Gas/Electricity Classes Rehab Treatment Cord Blood

About Variables


A variable is a name that has a value. A variable can have different values at different times.

All variables must be declared. When a variable is declared, it is given a type that tells what kind of values it can have. It may also be given an initial value. An int variable can only have an integer value, a String variable can only have a character string as its value, and so on.
We would see following type of variables in Java:

  • Local Variables
  • Class Variables (Static Variables)
  • Instance Variables (Non-static variables)



The variable name called Identifiers

Java Identifiers 

In Java, there are several points to remember about identifiers. They are as follows:

  • All identifiers should begin with a letter (A to Z or a to z), currency character ($) or an underscore (_).
  • After the first character identifiers can have any combination of characters.
  • A key word cannot be used as an identifier.
  • Most importantly identifiers are case sensitive.
  • Examples of legal identifiers: age, $salary, _value, __1_value
  • Examples of illegal identifiers: 123abc, -salary


identifiers using in difference ways







No comments:

Post a Comment