Class field

Class can have its own variables. They are called fields.


class Rectangle {
   int Width;
   int Height;
   
}

Here the width and height are fields of Rectangle type.

Fields can have the following modifiers:

  1. static
  2. public
  3. internal
  4. private
  5. protected
  6. unsafe
  7. readonly
  8. volatile
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.