public const int CostOfFoodPerPerson = 25;
public int NumberOfPeople {
get { return numberOfPeople; }
set {
numberOfPeople = value; // I think value is a hidden object in the calss.
}
}
Java:
I can only implement the const by define the variable like below,
public final static int CostOfFoodPerPerson = 25;
Modifier | Class | Package | Subclass | World |
---|---|---|---|---|
public | Y | Y | Y | Y |
protected | Y | Y | Y | N |
no modifier | Y | Y | N | N |
private | Y | N | N | N |
Comments
Post a Comment