Given the following code:
public static void main(String[] args) {
String[] planets = {"Mercury", "Venus", "Earth", "Mars"};
System.out.println(planets.length);
System.out.println(planets[1].length());
}
What is the output?
A.
4
4
4
B.
3
5
5
C.
4
7
7
D.
5
4
4
E.
4
5
5
F.
4
21
21
題解
planets是一個長度為4的字串陣列。planets[1]所參考到的字串物件是「Venus」,長度為5。