Created
November 1, 2012 01:50
-
-
Save anirudhjoshi/3991115 to your computer and use it in GitHub Desktop.
CircleTest2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CircleTest2 { | |
public static class Circle_1 { | |
public float r = 100; | |
public float getR(){ return r;} | |
} | |
public static class GraphicCircle_1 extends Circle_1 { | |
public float r = 10; | |
public float getR(){ return r;} | |
} | |
public static void main(String[] args){ | |
GraphicCircle_1 gc = new GraphicCircle_1(); | |
Circle_1 c = gc; | |
System.out.println("Radius = " + gc.r); | |
System.out.println("Radius = " + c.r); | |
System.out.println("Radius = " + gc.getR()); | |
System.out.println("Radius = " + c.getR()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment