Created
October 10, 2017 04:31
-
-
Save danielkwok21/78c5957c0b907efc58e16069103033a2 to your computer and use it in GitHub Desktop.
OOP example
This file contains 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
public class Car { | |
public void drive(){ | |
System.out.println("Vroom vroom"); | |
} | |
public void honk(){ | |
System.out.println("Honk Honk"); | |
} | |
public void radio(){ | |
System.out.println("Song Song"); | |
} | |
} |
This file contains 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
public class myCar { | |
public static void main(String args[]){ | |
Porsche myPorsche = new Porsche(); | |
myPorsche.honk(); | |
} | |
} | |
This file contains 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
import java.util.*; | |
public class Porsche extends Car{ | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment