Run ❯
Get your
own Java
server
❯
Run Code
Ctrl+Alt+R
Change Orientation
Ctrl+Alt+O
Change Theme
Ctrl+Alt+D
Go to Spaces
Ctrl+Alt+P
class Animal { String type = "Animal"; } class Dog extends Animal { String type = "Dog"; public void printType() { System.out.println(super.type); // Access parent attribute } } public class Main { public static void main(String[] args) { Dog myDog = new Dog(); myDog.printType(); } }
Animal