Java examples for Object Oriented Design:interface
Interface with a Nested Class and a Constant Field
interface Walkable { // A nested class class Dog implements Walkable { private Dog() { // Do not allow outside to create its object }// w w w .ja v a 2 s .c o m public void walk() { System.out.println("Nothing serious to run..."); } } Walkable Default = new Dog(); // An abstract method void walk(); } public class Main { public static void main(String[] args) { my(Walkable.Default); } public static void my(Walkable a) { a.walk(); } }