1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
solmaris [256]
3 years ago
12

Create a static method called fillArray, which takes an integer array as an input parameter, along with an integer initial value

. It should then fill the array with values starting from the initial value, and counting up by 1s. For example, if the data array has length 5, and if the initialValue is 3, then after execution the array should hold this sequence: 3 4 5 6 7. public static void fillArray (int[] data, int initialValue) {
Computers and Technology
1 answer:
JulijaS [17]3 years ago
3 0

Answer:

public class print{

   

   public static void fillArray(int[] arr, int initialValue){

       

       int n = arr.length;

      for(int i=0;i<n;i++){

          arr[i] = initialValue++;

      }

       for(int i=0;i<n;i++){

           System.out.print(arr[i]+" ");

      }

       

   }

    public static void main(String []args){

       

        int[] array = new int[5];

        int initialValue =3;

       

        fillArray(array,initialValue);

       

    }

}

Explanation:

Create the function with two parameter first is array and second is integer.

Then, declare the variable and store the size of array.

Take the for and fill the array from the incremented value of initialValue  by 1 at every run of loop.

After loop, print the element of the array.

Create the main function which is used for calling the function and also declare the array with size 5 and initialValue with 3. After that, call the function with this argument.

You might be interested in
The means by which an operating system or any other program interacts with the user is called th
natulia [17]
Networking capabilities of a computer
7 0
3 years ago
What is the memory of a computer called
Nataliya [291]
It is called Ram in another term for memory :)
6 0
3 years ago
Read 2 more answers
20 points
adoni [48]
Yes it's important. It's like taking jotting down the ideas you have for a project, you don't want to forget anything, and these things help you keep track of what you want to do.

Answer would be false.
4 0
2 years ago
Viktor has climbed a tall tree to get a good view of the giraffes on the savannah. He is snapping lots of photographs of the gir
igomit [66]

Answer: C. a good vantage point

3 0
3 years ago
You need a version of usb technology that will support older usb devices, of which you have many, as well as newer ones. what wo
andrezito [222]
I would want to see the word compatible in the specs
8 0
3 years ago
Other questions:
  • Build three classes that conform to the following interfaces. Use arrays in creating your classes (e.g., do not use the built-in
    8·1 answer
  • Is printer an input device​
    5·1 answer
  • Why is it important for people to express resentments in the workplace?
    9·1 answer
  • Complete the following method named replaceEvens that receives the parameter numbers which is an array of integers. The method m
    5·1 answer
  • What do the buttons on the paste options menu do
    11·1 answer
  • Host Y sends the first TCP ACK message for the transaction?<br><br> a. true<br><br> b. false
    9·1 answer
  • How do I modify objects in power point 2016 for an assignment
    11·1 answer
  • Xercise 1<br>1.<br>What is system? Explain the components of system in brief.​
    12·1 answer
  • How do I change my username/display name
    12·2 answers
  • 16. A/An __________ is operated on the principle that the dying have special needs and wants that hospital personnel are too bus
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!