Snake
Snake
JCHJava Community | Help. Code. Learn.
Created by sadstephen on 1/19/2025 in #java-help
Can I make a superclass's variable static final in subclass?
When these variables use the same name, you get shadowing, but the names being the same doesn’t result in encapsulation or polymorphism.
21 replies
JCHJava Community | Help. Code. Learn.
Created by sadstephen on 1/19/2025 in #java-help
Can I make a superclass's variable static final in subclass?
Encapsulation is just when one object is a field in another.
21 replies
JCHJava Community | Help. Code. Learn.
Created by sadstephen on 1/19/2025 in #java-help
Can I make a superclass's variable static final in subclass?
Polymorphism is when you have an instance of a subclass in a superclass-type variable.
21 replies
JCHJava Community | Help. Code. Learn.
Created by sadstephen on 1/19/2025 in #java-help
Can I make a superclass's variable static final in subclass?
No.
21 replies
JCHJava Community | Help. Code. Learn.
Created by sadstephen on 1/19/2025 in #java-help
Can I make a superclass's variable static final in subclass?
So if you write about in the subclass, it will refer to Bots.subclass.
21 replies
JCHJava Community | Help. Code. Learn.
Created by sadstephen on 1/19/2025 in #java-help
Can I make a superclass's variable static final in subclass?
Good question. The effect should be that both separate variables still exist, but the one in the subclass shadows the one in the superclass.
21 replies