Q&A

Q1:

Do arrays have to begin with an element 0, or can they range from a higher minimum number to a higher maximum number, such as 65 to 90?

A1:

They don't have to begin at element 0, but it is more efficient to do so because it takes up less memory in the computer to store arrays that begin with 0. You can use arrays of a higher index number simply by referring to the numbers you want to use. For example, if you created a for loop that cycled from array element 65 to element 90, you could disregard any other element numbers. However, there still will be array elements numbered from 0 to 64 taking up space in memory, even if you don't use them for anything.

Q2:

Is the numeric range of the alphabet, from 65 for A to 90 for Z, part of the basic Java language? If so, what are 1 through 64 reserved for?

A2:

The numbers 1 through 64 include numerals, punctuation marks, and some unprintable characters, such as linefeed, newline, and backspace. A number is associated with each printable character that can be used in a Java program, as well as some unprintable ones. Java uses the Unicode numbering system, which supports more than 60,000 different characters from the different languages of the world. The first 127 characters are from the ASCII character set, which you might have used in another coding language.

Q3:

Why are some errors called exceptions?

A3:

The significance of the term is that a program normally runs without any problems, and the exception signals an exceptional circumstance that must be dealt with. Exceptions are warning messages that are sent from within a Java program. In the Java language, the term error is sometimes confined to describe error conditions that take place within the interpreter running a program. You learn more about both subjects during Hour 18, "Handling Errors in a Program."

Q4:

In a multidimensional array, is it possible to use the length variable to measure different dimensions other than the first?

A4:

You can test any dimension of the array. For the first dimension, use length with the name of the array, as in x.length. Subsequent dimensions can be measured by using length with the [0] element of that dimension. Consider an array called data that was created with the following statement:

int[][][] data = new int[12][13][14];


The dimensions of this array can be measured by using the data.length variable for the first dimension, data[0].length for the second, and data[0][0].length for the third.

Q5:

Can the length variable be set to increase or decrease the size of an array after it has been created?

A5:

There's no way to modify the size of an array after it has been created; length is strictly used to find out an array's upper boundary.

Q6:

Who did the singing for Milli Vanilli?

A6:

The vocals were performed by John Davis and Brad Howell, two former U.S. soldiers living in Germany who were recruited by Milli Vanilli producer Frank Farian. Another ex-soldier, Charles Shaw, performed the rap portion of the single "Girl You Know It's True." Because Howell didn't want to tour, Farian hired Rob Pilatus and Fabrice Morvan and presented them as the band's singers. After the news broke that Pilatus and Morvan didn't sing on their albums, the real singers released The Moment of Truth and called themselves The Real Milli Vanilli. Pilatus and Morvan also released an album as Rob & Fab. All of the projects were commercial failures.

      
Comments