【正确答案】
B、C
【答案解析】 String类的lengm()方法可以用来求解字符串的长度,数组的length属性用来求解数组的大小,如下例所示:
public class Test
{
public static void main(String argv[])
{
int a[]={1};
System.out.println(a.length);
String s="Hello";
System.out.println(s.length());
}
}
程序的运行结果为:
1
5
因此,选项B与选项C正确。