Java Reference
In-Depth Information
Example
public interface Measurable
{
double getMeasure();
}
Purpose
To define an interface and its method signatures. The methods are automatically
public.
S YNTAX 9.2: Implementing an Interface
public class ClassName
implements InterfaceName, InterfaceName, . .
.
{
methods
fields
}
Example
public class BankAccount implements Measurable
{
// Other BankAccount methods
public double getMeasure()
{
// Method implementation
}
}
Purpose
To define a new class that implements the methods of an interface
392
393
ch09/measure1/DataSetTester.java
1 /**
2 This program tests the DataSet class.
3 */
4 public class DataSetTester
Search WWH ::




Custom Search