Friday, 22 January 2016

Java OOP Programmes

1. Exercise

public class Cat {
  private int weight;

  public Cat() {
     weight = 42;
  }

  public int getWeight() {
    return weight;
  }
  public void setWeight(int newWeight) {
    weight = newWeight;
  }
}

No comments:

Post a Comment