Learning Java – (Video 8) Tutorial Series – Interface

This is eighth video in the series of Learning Java, In this video Interface is explained with example. Interface is important concept of Object Orient Programming languages.

If you feel this video is useful, Please share it with your friends on Facebook, twitter Google plus etc.
 

Code developed in this tutorial provided below:

public interface SocialMediaContract {
	
	public void postMessage(String message);
	public void likeMessage(int messageID);

}

 

public class FacebookService implements SocialMediaContract {

	@Override
	public void postMessage(String message) {
		// TODO Auto-generated method stub
		System.out.println("Facebook service posted message");
	}

	@Override
	public void likeMessage(int messageID) {
		// TODO Auto-generated method stub
		System.out.println("Facebook service liked message");
		
	}
}

 

public class TwitterService implements SocialMediaContract {

	/* (non-Javadoc)
	 * @see SocialMediaContract#postMessage(java.lang.String)
	 */
	@Override
	public void postMessage(String message) {
		// TODO Auto-generated method stub
		System.out.println("Twitter service posted message");
	}

	/* (non-Javadoc)
	 * @see SocialMediaContract#likeMessage(int)
	 */
	@Override
	public void likeMessage(int messageID) {
		// TODO Auto-generated method stub
		System.out.println("Twitter service liked message");
	}
}

 
For further reading refer Java Programming Category posts.

Learning Java Interface Example
Tagged on:     

Leave a Reply

Your email address will not be published. Required fields are marked *