Relative Content

Tag Archive for javainheritancemethodsoverriding

Using Override for a method in a subclass in Java

In Java, we’re using classes and inheritance to make a monster game. I think I’ve created the parent class properly. Some code was provided by the professor in the parent class called “Monster,” and I don’t get any errors when I run it. The next part is to create two sub classes called “Goblin” and “Dragon.” I can’t seem to get past an error in my Dragon class, when trying to override a method created in the “Monster” class. The code for the “monster” class is: