public class Shape { int x = 0; public void draw() { System.out.println("Draw a shape"); } public void displayX() { System.out.println(x); } } public class Circle extends Shape { int x = 1; public void draw() { System.out.println("Draw a circle"); } public void displayX() { System.out.println(x); } } public class Test { public static void main(String[] args) { Shape shape = new Circle(); shape.draw(); shape.displayX(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)