Start of Tutorial > Start of Trail > Start of Lesson |
Search
Feedback Form |
- What is the index of
Brighton
in the following array?String[] skiResorts = { "Whistler Blackcomb", "Squaw Valley", "Brighton", "Snowmass", "Sun Valley", "Taos" };- Write an expression that refers to the string
Brighton
within the array.- What is the value of the expression
skiResorts.length
?- What is the index of the last item in the array?
- What is the value of the expression
skiResorts[4]
?
Check your answers.
- The following program,
WhatHappens
, contains a bug. Find it and fix it.// // This program compiles but won't run successfully. // public class WhatHappens { public static void main(String[] args) { StringBuffer[] stringBuffers = new StringBuffer[10]; for (int i = 0; i < stringBuffers.length; i ++) { stringBuffers[i].append("StringBuffer at index " + i); } } }
Start of Tutorial > Start of Trail > Start of Lesson |
Search
Feedback Form |