java - Override the method -


i'm asked override method implement new behaviors, have made constructor , method.

private string  name; private boolean disease;   public area(position pos, string name, boolean disease) {     super(pos);      this.name   = name;     this.disease = disease; }    public string getname() {     return name; } 

and method have override disease can stopped on area if medicine enough

public boolean hasdisease() {     return disease; }  

i tried using

    if (medicine = true) {          disease = false     }      return disease = true;  } 

but cause other tests fail.

you used = instead of == test equality.

if(medicine == true) { // <-- fixed this.     disease = false }      return disease = true;  } 

you can fix more:

if(medicine)     disease = false return disease;  

Comments

Popular posts from this blog

c++ - How to add Crypto++ library to Qt project -

jQuery Mobile app not scrolling in Firefox -

How to use vim as editor in Matlab GUI -