码迷,mamicode.com
首页 > 编程语言 > 详细

java中字符串数组、字符串、调用split方法后长度比较

时间:2015-02-03 19:04:26      阅读:125      评论:0      收藏:0      [点我收藏+]

标签:

通过eclipse测试:

    String temp2 = "";
                String[] temp = temp2.split(",");
                String[] temp3 = {};
                
                System.out.println("............................."+temp2.length());
                System.out.println("***************"+temp.length);
                System.out.println("-----------------"+temp3.length);

技术分享

temp.length的长度为1。

因为{}和{""}是不同的,相当于null和""的关系。

 

java中字符串数组、字符串、调用split方法后长度比较

标签:

原文地址:http://www.cnblogs.com/Teofil/p/4270385.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!