Mine is jdk1.8. After the variable is modified by final, the variable can be modified in the subclass and the compilation is successful. Why?
伟仔
伟仔 2018-01-14 18:01:00
0
0
1508

 class Fu{

//public int x=10;

final public  int j=20;

public  void show(){

System.out.println("Fu show()");

}

}


class  Zi extends Fu {

 

public void show(){

//int x=100;

int j=200;

System.out.println("Zi show()");

//System.out.println(x);

System.out.println(j);

}

}


class FinalDemo1 {

public static void main(String[] args){

Zi z= new Zi();

z.show();

 

}

}


伟仔
伟仔

reply all(0)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!