What is Field or Variable?
 
 

The Fields are the parts of an Object and hold state or one or information about an Object. In the above illustration, computer ON or OFF indicates the state of the object.

But how a computer will retain this information?

Variable for the fields: The Variables are used to hold those information you want a computer to keep in it's memory to be used as needed. These are categories of variables you need to know.

  • Change or No Change:
    • Non-Static Variables: You expect that the state of information may change time to time.
    • Static Variables : You want to use a constant value all the time.
  • Scope
    • Local Variable :
    • Public Variable.
    • Protected Variable
  • Use against an Argument (parameter). Often you send Variables  while calling another method, that has a set of rule to expect some inputs from the callers. For the details follow this link
The image below shows the importance of Public Variables, these variables can be used all the method-members of this class and the child or derived class that will inherit a parent class. On the other hand local variables are meant to be used by local methods, and can't be accessed from out side.