O'Reilly logo

Java, A Beginner’s Guide, 5th Edition by Herbert Schildt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Image Chapter 5 Self Test

1. Show two ways to declare a one-dimensional array of 12 doubles.

2. Show how to initialize a one-dimensional array of integers to the values 1 through 5.

3. Write a program that uses an array to find the average of 10 double values. Use any 10 values you like.

4. Change the sort in Try This 5-1 so that it sorts an array of strings. Demonstrate that it works.

5. What is the difference between the String methods indexOf( ) and lastIndexOf( )?

6. Since all strings are objects of type String, show how you can call the length( ) and charAt( ) methods on this string literal: “I like Java”.

7. Expanding on the Encode cipher class, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required