access to shadowed variable in local class

前端 未结 2 800
野趣味
野趣味 2021-01-20 15:15

i\'m new in java and i confused for below example

public class Test {

   int testOne(){  //member method
       int x=5;
         class inTest  // local cl         


        
2条回答
  •  感情败类
    2021-01-20 15:21

    this. is used to access members - a local variable is not a member, so it cannot be accessed this way when it's shadowed.

提交回复
热议问题