Click here to watch in Youtube :
https://www.youtube.com/watch?v=PoJB6AoM-Dc&list=UUhwKlOVR041tngjerWxVccw
Click the below Image to Enlarge
Java Tutorial : Java abstract class(implements interface) |
public interface Person { public void walk(); public void eat(); } abstract class Employee implements Person { } class EmployeeImpl extends Employee { @Override public void walk() { System.out.println("walking"); } @Override public void eat() { System.out.println("eating"); } }
public class AbstractClassTest { public static void main(String[] args) { Person personRef = new EmployeeImpl(); personRef.eat(); personRef.walk(); System.out.println("-------------------------"); Employee employeeRef = new EmployeeImpl(); employeeRef.eat(); employeeRef.walk(); } }
eating walking ------------------------- eating walking
https://sites.google.com/site/javaee4321/java/AbstractClassDemo_Interface_App.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/AbstractClassDemo_Interface_App
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/cca1e1df516bcb14a74fa137b20f412f56eb3b59/BasicJava/AbstractClassDemo_Interface_App/?at=master
See also:
No comments:
Post a Comment