/* Abstract and parametric classes. You now know that an interface can only contain headers (specifications), not actual code. A class that implements an interface must provide code for all the functions specified by the interface. An "abstract class" is basically something in between a purely abstract interface and an actual class. It may contain specifications (headers) as well as real functions. interfaces, classes, and abstract classes can all be parametric (take type variables such as */ abstract class multiplier { abstract Ty doubleup(Ty x); // must be implemented in subclasses // functions can be written that call doubleup as if it's already defined: Ty quadruple(Ty x) { return doubleup(doubleup(x)); } // quadruple is "polymorphic". } // concrete classes: class number extends multiplier { Integer doubleup(Integer x) { return x*2; } } class word extends multiplier { String doubleup(String w) { return w+w; } } public class abstracts { public static void main(String[] args) { number N = new number(); word W = new word(); System.out.println(N.quadruple(4)); System.out.println(W.quadruple("hello")); }//main }