Final answer:
The MyNumbers Java application declares an integer array, populates it using a for loop, prints the array, changes a specific value, and reprints the modified array to match the desired output.
Step-by-step explanation:
To create a Java application called MyNumbers that meets the requirements provided, we will write a program that accomplishes the following:
- Declares an integer array to hold ten numbers.
- Populates the array using a for loop, starting with 5 and incrementing by 5 for each subsequent element.
- Prints out the array elements with a tab in between each number using another for loop.
- Changes the value of the element containing 35 to 77.
- Reprints the array, starting with a newline character.
Here is the code for the MyNumbers application:
public class MyNumbers {
public static void main(String[] args) {
int[] numbers = new int[10];
for (int i = 0; i < numbers.length; i++) {
numbers[i] = 5 + (i * 5);
}
for (int number : numbers) {
System.out.print(number + "\t");
}
System.out.println();
for (int i = 0; i < numbers.length; i++) {
if (numbers[i] == 35) {
numbers[i] = 77;
break;
}
}
for (int number : numbers) {
System.out.print(number + "\t");
}
}
}
This will produce the desired output:
5 10 15 20 25 30 35 40 45 50
5 10 15 20 25 30 77 40 45 50