// You're looking at a file named Class1.java,
// which defines a class named Class1 that implements
// the interface named Interface1.
//
// Ordinarily, we would write a purpose statement
// for each field and for each method, but we're leaving
// them out to emphasize the simplicity of Java class
// definitions.
//
//
//
//
//
//
//
//
//
//
//
//
class Class1 implements Interface1 {
int x;
int y;
int r;
// A JAVA CONSTRUCTOR GOES HERE
// These are the method definitions.
public int foo () {
return x + y;
}
public int bar (int n) {
return r + n;
}
public int baz (int n) {
return this.bar(n) + n;
}
}
Although the class definition shown above will compile without errors, it is incomplete because we have omitted the Java constructor that will initialize the fields of objects of this class.