Studyon Minte9.com
Head First (Java)




Interface



A Java Interface solves your multiple inheritance problem.

	%java
		
		package testingapp;
		public class TestingApp {
		    public static void main(String[] args) {
		    }
		}

		abstract class Animal {
		    public abstract void setName();
		    public void eat(){};
		}

		interface Canine {
			// No 'class' word in interface declaration

		    public abstract void play();
		    
		    public void move(){};
			// Compile Error: Interface methods cannot have body
		}

		interface Feline {
		}

		class Dog extends Animal implements Canine {
		    
		    @Override
		    public void setName() {}
		    
		    @Override
		    public void play() {}
		}