Skip to content

Instantly share code, notes, and snippets.

@smamran
Created October 7, 2015 12:36
Show Gist options
  • Select an option

  • Save smamran/9b8e91e85121c0606889 to your computer and use it in GitHub Desktop.

Select an option

Save smamran/9b8e91e85121c0606889 to your computer and use it in GitHub Desktop.
Abstract Class Example
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