Skip to content

Instantly share code, notes, and snippets.

@zoolu-got-rhythm
Created February 17, 2016 01:00
Show Gist options
  • Save zoolu-got-rhythm/a1054ef7f64cf68e3701 to your computer and use it in GitHub Desktop.
Save zoolu-got-rhythm/a1054ef7f64cf68e3701 to your computer and use it in GitHub Desktop.
public class Organism{
public Integer lifespan;
public int iq;
public String species;
// base class (super class)
public Organism(int lifespan, int iq, String species){
this.lifespan = lifespan;
this.iq = iq;
this.species = species;
}
public void summary(){
System.out.println(this.lifespan + "," + this.iq + " " + this.species);
}
public void age(int n){
if(n < 0) {
this.species + " has perished.";
} else{
this.lifespan - n; // compiler: "error: not a statement"
}
}
}
@encima
Copy link

encima commented Feb 18, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment