diff --git a/README.md b/README.md index 0561ef9..fc993ea 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,9 @@ class Human { this.name = name; } } +``` +```java class HelloWorld{ void main(String[] args){ Human matt = new Human("Matthew"); @@ -115,7 +117,9 @@ class SuperHuman extends Human { return this.power; } } +``` +```java class HelloWorld{ void main(String[] args){ SuperHuman superman = new SuperHuman("Clark", "flight"); @@ -127,7 +131,7 @@ class HelloWorld{ } ``` -## Abstract/Interface +## Abstract ```java abstract class Car { @@ -136,13 +140,17 @@ abstract class Car { System.out.println("screeeeech"); } } +``` +```java class Sedan extends Car{ void drive(){ System.out.println("vroom"); } } +``` +```java class HelloWorld{ void main(String[] args){ Sedan myCar = new Sedan(); @@ -152,17 +160,23 @@ class HelloWorld{ } ``` +## Interface + ```java interface Bird { void fly(); } +``` +```java class Swallow implements Bird { public void fly() { System.out.println("sweeeee"); } } +``` +```java class HelloWorld{ void main(String[] args){ Swallow stewart = new Swallow();