Posted By:
Andreas_Wolf
Posted On:
Saturday, December 7, 2002 11:57 PM
1. I'm afraid: No. Access to class members in Java can be only one of private (only the class itself can access them - not even child classes can), protected (all classes in the same package can access them) and public (everybody can access them).
2. Default values for arguments as well as the ellipsis
(...) declarator for variable length parameter sets are
available in C++, but not in Java. Again: No.
3. There are no "enums" in Java itself, but you can
easily create typesafe collections of values using the
following technique:
class Weekday {
public static final Weekday mon = new Weekday();
public static final Weekday tue = new Weekday();
private Weekday() {}
}
Declaring the constructor as private, variables of type
Weekday can only be assigned (and thus only have a defined set of values), using Weekday.mon, Weekday.tue, etc...