Question: Write a method that accepts a maximum number as an argument and prints each number from 1 up to that maximum, inclusive, enclosed in square
Write a method that accepts a maximum number as an argument and prints each number from 1 up to that maximum, inclusive, enclosed in square brackets. For example, if you passed 5 as an argument to the method, it would display:
[1] [2] [3] [4] [5]
You may name this method printNumbers.
Assume that any value passed to the method will be at least 1.
To find the maximum value, use the following array and search through it to find the max value like we did in a previous assignment.
int[] findMax = {2, 5, 3, 9, 7, 10} Submit: 1)
.java source file with your name 2)
Screenshot of output
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
