- class Outer {
- String string="Outer string";
- public void printing(){
- System.out.println("Outer");
- }
- }
- class inner extends Outer{
- String string="inner string";
- public void printing(){
- System.out.println("inner");
- }
- }
- public class Test2 {
-
- /**
- * @param args
- */
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- Outer i=new inner();
- (( Outer) i).printing();
- System.out.println(((Outer)i).string);
- }
- }
复制代码 |
|