标签:rgs demo out main div 长度 public system 字符串
length是对数组而言的,指的是数组的长度。
length()是对字符串而言的,指的是字符串所包含的字符个数。
public class LengthDemo { public static void main(String args[]) { String str = "Today is Monday"; System.out.println(str.length()); String[] str2 = {"abc","good","alas","ok"}; System.out.println(str2.length); int[] a = new int[5]; System.out.println(a.length); } }
结果:
15
4
5
标签:rgs demo out main div 长度 public system 字符串
原文地址:http://www.cnblogs.com/deltadeblog/p/7113123.html