Skip to main content
IBM 
ShopSupportDownloads
IBM HomeProductsConsultingIndustriesNewsAbout IBM
Java Language EssentialsDownload tutorial zip fileEmail this tutorial to a friend
Main menuSection menuGive feedback on this tutorialPrevious panelNext panel
Exercises
  


3. Using Java Arrays: Tasks page 8 of 31


For this exercise you will create and initialize an array of integers and an array of String objects.

[If you are using IBM's VisualAge for Java for this exercise, then use the scrapbook to type and test your code (without a main() method etc...), thus, avoiding the need to fill in the skeleton code, compile, and run from the command line.].

For more help with exercises, see About The Exercises

Prerequisites
  • None.

Tasks

  • Task 1

    Make an array of 5 integers.

  • Task 2

    Use a for loop to set the values of the array to the index plus 10.

  • Task 3

    Use a for loop to print out the values in the array.

  • Task 4

    Make an array of strings initialized to Frank, Bob, and Jim using the variable initializer syntax.

  • Task 5

    Use a for loop to print out the strings in the array.

  • Task 6

    Set the last element of the array to Mike.

  • Task 7

    Print out the last element in the array.

Help for each of these tasks can be found on the next page.


copyright 1996-2000 Magelang Institute dba jGuru


Main menuSection menuGive feedback on this tutorialPrevious panelNext panel
PrivacyLegalContact