4.2 Declaring Attributes

Previous Index Next 


Attributes on a class are decalred at the start of the class body. These declarations take the form of:
 
[FieldModifiers] FieldType Identifier [= InitialValue];
where Here is an example attribute definitions:
public class HoldValues
 {
  protected int x;
  public int y;
  private String myString;
  final int MAX_VALUE = 5;
  static long counter = 0;
 }


Sources 1