Learning Java – (Video 9) Tutorial Series – Abstract

This is ninth video in the series of Learning Java, In this video abstract class and method are explained in java programming via examples. Interface and Abstract difference explained.

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 abstract class MediaClass {

	public abstract void postMessage(String message);
	public void likeMessage(int messageID){
		System.out.println("Liked message in Media Class itself");
	}	
}

 

public class FacebookService extends MediaClass 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");
		
	}
}

 
For further reading refer Java Programming Category posts.

Learning Java Abstract Class Example
Tagged on:     

Leave a Reply

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