16-07-31 Cannot refer to the non-final local variable homePageInfo defined in an enclosing scope

来源:互联网 发布:ambari web 源码编译 编辑:程序博客网 时间:2024/05/22 08:04

在做android测试时,发生错误为Cannot refer to the non-final local variable homePageInfo defined in an enclosing scope

在使用Java局部内部类或者内部类时,若该类调用了所在方法的局部变量(或参数),则该局部变量(或参数)必须使用final关键字来修饰,否则就会出现上面的错误。

添加final后ok.



0 0
原创粉丝点击