Answer:
Character 'I' (the beginning character of the string).
String Indexing
The beginning character of a string corresponds to index 0
and the last character corresponds to the index
.
The length of a string is the number of characters it contains, including spaces, punctuation, and control characters. Fill in the following table by clicking on the buttons.
| Code | Value |
|---|---|
"buttons".length() | |
"buttons and bows".length() | |
"buttons/tand/tbows".length() | |
"".length() |
The sequence "/t" stands for a single character, a tab character.
Each tab character counts as
one character (although it might be displayed on a monitor or printer using several spaces).
Be careful about the difference between an empty string, and a null reference. An empty string is an object that contains no characters, and so has length 0. A null reference means there is no object present.
QUESTION 4:
What does the following code write?
String myString = null;
System.out.println("The length is: " + myString.length() )