Skip to content

Instantly share code, notes, and snippets.

@lyxal
Created May 16, 2021 23:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lyxal/423c8bd590b05127e11d0e20c0ba7958 to your computer and use it in GitHub Desktop.
Save lyxal/423c8bd590b05127e11d0e20c0ba7958 to your computer and use it in GitHub Desktop.
public class Controller {
public static void main(String[] args){
Mammal joe = new Mammal();
Dog other = new Dog("Not Joe", 69);
joe.speak();
other.speak();
joe.printInformation();
other.printInformation();
joe.<Integer, Integer>setAttribute(Mammal.AGE, 20);
other.<Integer, Float>setAttribute(Mammal.WEIGHT, Float.valueOf("69.420"));
joe.printInformation();
other.printInformation();
}
}
public class Dog extends Mammal {
public Dog(){
super();
noise = "bark or something idk";
}
public Dog(String pName, int pAge){
super(pName);
age = pAge;
noise = "bark or something idk";
}
public Dog(String pName, int pAge, float pWeight){
super(pName, pAge);
weight = pWeight;
noise = "bark or something idk";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment