The final local variable xxx cannot be assigned, since it is defined in an enclosing type
来源:互联网 发布:槽钢承载力计算软件 编辑:程序博客网 时间:2024/05/20 21:21
原文地址:http://blog.163.com/benben_long/blog/static/199458243201481102257544/
本文就自己编程时候遇到的一个问题,简要描述一下,并提出解决的方法:
出错信息:The final local variable xxx cannot be assigned, since it is defined in an enclosing type“,其中xxx是一个局部变量名
首先这是一个java编译时的错误,翻译成中文是:不可变的局部变量不能被赋值,因为它已经被定义在一个封闭类型中。
解决的办法:将xxx 作一下封装,用集合或者数组,如果xxx是基本数据类型一般用数组。
如:xxx为 String类型的话,
可以封装成 String[] xxx=null;
然后在接下来用到 xxx 变量的地方, 将xxx 写成 xxx[0];
xxx 如果为对象的话,那么可以用集合 将xxx进行封装.....
我遇到的情况是这样的:
本来是想用一个boolean类型的变量的。但是不可以。
2 0
- The final local variable xxx cannot be assigned, since it is defined in an enclosing type
- The final local variable xxx cannot be assigned, since it is defined in an enclosing type
- The final local variable xxx cannot be assigned, since it is defined in an enclosing type“
- The final local variable xxx cannot be assigned, since it is defined in an enclosing type“,
- The final local variable xxx cannot be assigned, since it is defined in an enclosing type
- The final local variable xxx cannot be assigned, since it is defined in an enclosing type
- The final local variable cannot be assigned, since it is defined in an enclosing type
- The final local variable cannot be assigned, since it is defined in an enclosing type的解决办法(把变量从局部编程)
- 解决问题:Cannot refer to the non-final local variable user defined in an enclosing scope
- 16-07-31 Cannot refer to the non-final local variable homePageInfo defined in an enclosing scope
- The type java.xxx.Xxx cannot be resolved. It is indirectly referenced from required.class
- The type XXX cannot be resolved. It is indirectly referenced from required .class files错误.....
- the type xxx cannot be resoved,It is indirectly referenced from required .class files错误.....
- The type XXX cannot be resolved. It is indirectly referenced from required .class files
- [Eclipse] The type XXX cannot be resolved. It is indirectly referenced from required .class files错误.
- [Eclipse] The type XXX cannot be resolved. It is indirectly referenced from required .class files错误.
- The type XXX cannot be resolved. It is indirectly referenced from required .class files错误
- The type XXX cannot be resolved. It is indirectly referenced from required .class files
- 微乐邀请码、微乐二维码注册
- XML系列(一)------初识XML
- C语言之函数与返回值
- 二维码的生成细节和原理
- 9.1-9.30推荐文章汇总
- The final local variable xxx cannot be assigned, since it is defined in an enclosing type
- 周二时间过得真真的慢
- OS中assign、copy 、retain等关键字的含义
- PHP程序员的技术成长规划
- Referenced file contains errors (http://JAVA.sun.com/xml/ns/j2ee/web-app_2_5.xsd).
- 虚拟内存
- cocos2dx 安卓环境播放mid音乐
- unity3D调用外接摄像头,保存图片、不使用截屏方式
- iOS常用静态库操作命令