- class test_parent{
- int x = 5;
- int y = 10;
- int get_1(){
- return this.x + this.y;
- }
- }
- class test_4 extends test_parent{
- int y;
- test_4(int a){
- y = a;
- }
- }
- class Test2{
- public static void main(String[] args) {
- test_4 a1=new test_4(1);
- int x = a1.get_1();
- System.out.println("x="+x);
- }
- }
复制代码 输出的是15 是不是就是我题目的意思?
|