Java 1
Question 20
What will be printed by the following code?

String str = "Have a nice day!";
System.out.println(str.length());

a. Have a nice day
b. 16
c. 13
d. Have
e. 4

Question 21
Examine this code:

String str = "Hello World!" ;

What is the index of the character 'W'?

a. 6
b. 7
c. 5
d. 8
e. 2

Respuesta :

Answer:

Q20     b.16

Q21      a.6

Step-by-step explanation:

count charcters  Have a nice day!  ==16

Q21    why 6

because index start with 0 and not 1

just count

H ==> 0

e==> 1

l==> 2

.

.

W=>6

ACCESS MORE