eclipse - Java inheritance compilation -


i cannont compile simple java project 1 class inheritance.

without inheret class project compiles well, when add class message in eclipse: "errors exist in required project". strange if click "proceed" project runs fine, yet there message error after compilation. should not have error?

here code, have main class not in it.

    public class person {     private string name;     private int health;     private int x;     private int y;     random randomgenerator = new random();       public person(string name,int x,int y)     {         this.nom = name;         this.x = x;         this.y = y;         health = randomgenerator.nextint(100);     }     public void attack(int damage)     {         healh+=damage;     }     public int gethealth()     {         return health;      } } //without class warrior, not error message public class warrior extends person {     protected int damage;     public void faireattaque(person p)     {         p.attack(damage);     } } //when added warrior class, got error message 

your child class should implement constructor , call super.

public class warrior extends person {     public warrior(string name, int x, int y)     {         super(name,x,y);     }     //other stuff } 

Popular posts from this blog

html/hta mutiple file in audio player -

debugging - Reference - What does this error mean in PHP? -