Java Reference
In-Depth Information
}
class Test {
public static void main(String[] args) {
Seq<String> strs =
new Seq<String>(
"a",
new Seq<String>("b",
new Seq<String>()));
Seq<Number> nums =
new Seq<Number>(
new Integer(1),
new Seq<Number>(new Double(1.5),
new Seq<Number>()));
Seq<String>.Zipper<Number> zipper =
strs.new Zipper<Number>();
Seq<Pair<String,Number>> combined =
zipper.zip(nums);
}
}
8.1.3. Inner Classes and Enclosing Instances
An
inner class
is a nested class that is not explicitly or implicitly declared
static
.
time error occurs.
or a compile-time error occurs.
Inner classes may inherit static members that are not constant variables even though they
may not declare them.
Nested classes that are not inner classes may declare static members freely, in accordance
with the usual rules of the Java programming language. Member interfaces (§
8.5
) are im-
plicitly
static
so they are never considered to be inner classes.
Example 8.1.3-1. Inner Class Declarations and Static Members
class HasStatic {
static int j = 100;