String a;System.out.println("1:"+a);
来源:互联网 发布:打鱼平台游戏源码 编辑:程序博客网 时间:2024/06/05 23:46
今天遇到这样一个面试题:
public static void main(String[] args) {
String a;System.out.println("1"+a);
a="helloword";
System.out.println("2"+a);
}
最后打印的结果是:
A: 1:
2:helloword
B:1:null
2: helloword
C:1:NULL
2: helloword
D:运行异常
我选D,本来不太相信自己的答案,就去写了一下运行了一下:
结果是:Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The local variable a may not have been initialized
最终确认了我的猜想,
终结:遇到问题多动手,实践检验真理
阅读全文
0 0
- String a;System.out.println("1:"+a);
- Android问题:System.out.println('a'+'b')和System.out.println('1'+'2');
- byte a =(byte)129; System.out.println(a);//会输出什么呢?
- eclipse中system.out.println()出现问题,总是提示out cannot be resolved or is not a field
- System.out.println()方法
- System.out.println
- System.out.println()
- System.out.println performance
- 关于System.out.println
- System.out.println
- System.out.println
- System.out.println
- 告别System.out.println()
- java System.out.println()
- System.out.println原理
- System.out.println()
- 关于 System.out.println
- String str;System.out.println(str);与String str = new String();System.out.println(str);区别
- 线性表
- NYOJ之”+-“字符
- HBase - 数据写入流程解析
- 2018第六届香港大数据与分析创新峰会将于4月在香港美丽华酒店召开!
- RocketMQ:The producer group has been created before, specify another name please.
- String a;System.out.println("1:"+a);
- 从零开始写爬虫111
- 你真的需要ETL工具吗?
- 向ElasticSearch 请求数据
- 聊聊TCP
- Android5.0之NavigationView的使用
- [kernel 启动流程] (第六章)第一阶段之——打开MMU
- js基础知识
- Dubbo详细介绍与安装使用过程