55.9k views
5 votes
1) Write a statement that defines an array of four integers named miles. The array should be initialized with the values 1, 5, 9, and 22.

2) Write a statement that defines an array of string objects nameddirections. The array should be implicitly sized, with an initialization list containing the values "Up", "Down", "Left", and "Right.

User Elhef
by
5.9k points

1 Answer

5 votes

Answer:

Step-by-step explanation:

The following code statements are written in Java and are simple one line statements that can be into any Java code or function. The first code statement creates a simple integer array with 4 predefined values initialized.

1) int[] miles = {1,5,9,22};

The second code statement creates a simple String array with four-string objects in it.

2) String[] nameddirections = {"Up", "Down", "Left","Right"};

User Alies
by
5.8k points