Created
October 7, 2015 12:36
-
-
Save smamran/9b8e91e85121c0606889 to your computer and use it in GitHub Desktop.
Abstract Class Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package slidenerd.javaoop; | |
| /** | |
| * Created by Microsoft on 10/7/2015. | |
| */ | |
| public class AbstractClassMethod { | |
| public static void main(String[] args) { | |
| Human human = new Human(); | |
| human.printInfo(); | |
| LivingBody livingBody = new LivingBody() { | |
| @Override | |
| void printInfo() { | |
| System.out.println("This livingbody is from Main"); | |
| } | |
| }; | |
| livingBody.printInfo(); | |
| } | |
| } | |
| abstract class LivingBody { | |
| String sound; | |
| abstract void printInfo(); | |
| } | |
| class Human extends LivingBody { | |
| String character = "Human Class"; | |
| public void printInfo() { | |
| System.out.println(character); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment