“Cannot subclass the final class” error, but the class is not final [on hold]

  • A+
Category:Languages

Here is my code:

package basic;  public abstract class Entity {} 

package characters;  import basic.Entity;  public abstract class Character extends Entity {} 

package player;  public class Player extends Character {} 

I am getting the

The type Player cannot subclass the final class Character.

but I checked a million times and I am yet to use final all but ONCE in my project. What gives?

 


You are extending java.lang.Character (which does not need an import, as it comes from java.lang).

Insert import characters.Character into your Player code.


Reference: using package members:

For convenience, the Java compiler automatically imports two entire packages for each source file: (1) the java.lang package and (2) the current package (the package for the current file).

Comment

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: