Click here to watch in Youtube :
https://www.youtube.com/watch?v=cz99wQXRLEs&list=UUhwKlOVR041tngjerWxVccw
Click the below Image to Enlarge
Java Tutorial : Java abstract class(shape) |
public abstract class Shape { abstract void draw(); } class Rectangle extends Shape { @Override void draw() { System.out.println("Drawing Rectangle..."); } } class Circle extends Shape { @Override void draw() { System.out.println("Drawing Circle..."); } }
public class AbstractClassTest { public static void main(String[] args) { Shape shapeRef = new Rectangle(); shapeRef.draw(); shapeRef = new Circle(); shapeRef.draw(); } }
Drawing Rectangle... Drawing Circle...
https://sites.google.com/site/javaee4321/java/AbstractClassDemo_Shape_App.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/AbstractClassDemo_Shape_App
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/4fab84407fb3cd7dfdf1a3243491a9e829c4d749/BasicJava/AbstractClassDemo_Shape_App/?at=master
See also:
No comments:
Post a Comment