Skip to content

Instantly share code, notes, and snippets.

@GrantSchiller
Created January 29, 2014 22:04
Show Gist options
  • Save GrantSchiller/8698104 to your computer and use it in GitHub Desktop.
Save GrantSchiller/8698104 to your computer and use it in GitHub Desktop.
public class Cat extends Pet {
public Cat(){
}
public void talk () {
System.out.println("purr");
}
}
public class Dog extends Pet {
public Dog(){
}
public void talk () {
System.out.println("bark");
}
}
public class Pet extends Projectile {
private String color;
private int age;
public Pet(){
String color = "Black";
int age = 5;
}
public Pet(String c, int a){
String color = c;
int age = a;
}
public void jump () {
System.out.println("Jump");
}
public void eat () {
System.out.println("Eat");
}
}
public class Projectile {
private int weight;
private int hardness;
public Projectile() {
weight = 8;
hardness = 5;
}
public Projectile(int w, int h) {
weight = w;
hardness = h;
}
public void toss() {
System.out.println("You cruel bastard");
if (weight > 5) System.out.println();
}
}
public class Runner {
public static void main(String[] args){
Cat c = new Cat();
Dog d = new Dog();
d.talk();
c.talk();
d.eat();
c.eat();
d.toss();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment