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]
2 years ago
13

Write a method reverse that takes an array as an argument and returns a new array with the elements in reversed order. Do not mo

dify the array.
Computers and Technology
1 answer:
mr Goodwill [35]2 years ago
4 0

Answer:

public class ArrayUtils

{

//function to reverse the elements in given array

public static void reverse(String words[])

{

//find the length of the array

int n = words.length;

//iterate over the array up to the half

for(int i = 0;i < (int)(n/2);i++)

{

//swap the first element with last element and second element with second last element and so on.

String temp;

temp = words[i];

words[i] = words[n - i -1];

words[n - i - 1] = temp;

}

}

public static void main(String args[])

{

//create and array

String words[] = {"Apple", "Grapes", "Oranges", "Mangoes"};

//print the contents of the array

for(int i = 0;i < words.length;i++)

{

System.out.println(words[i]);

}

//call the function to reverse th array

reverse(words);

//print the contents after reversing

System.out.println("After reversing............");

for(int i = 0;i < words.length;i++)

{

System.out.println(words[i]);

}

}

Explanation:

You might be interested in
Don't pat any attention to this
Sauron [17]

Answer: what? do you need any help, bc I can help with any question you have

Explanation:

4 0
3 years ago
Read 2 more answers
What is likely to happen to the economy when there’s too much money or credit circulating?
Svetlanka [38]
It depends on HOW much money is circulating. If governments just print money with nothing to back it, hyperinflation occurs. If there's a bit too much money and credit, inflation happens. Generally, 3% inflation is considered normal and a healthy amount by economists.
5 0
3 years ago
After a customer buys a computer or receives service from Top Computers and Service, a service representative contacts each cust
AlladinOne [14]

Answer: False

Explanation:

 The given statement is false, as the survey information basically represent feedback in which the service representative contact each and every customers to collect the feedback.

Feedback is in the form of information in which it represent the reaction in the scenario to the output but it basically affects as an input. Therefore, the survey information is in the form of input not as output.

7 0
3 years ago
Using selection sort, how many times longer will sorting a list of 40 elements take compared to a list of 5 elements
Hoochie [10]

It will take 8 times more time to sort a 40-element list compared to the time spent on a 5-element list.

We can arrive at this answer as follows:

  • We can see that if we divide a group of 40 elements into groups containing 5 elements, we will have 8 groups.
  • In this case, the time it would take to sort the list of one group of 5 elements would be repeated 8 times so that we could sort all the groups and their elements.

Another way to do this is to divide the number 40 by 5. We would have the number 8 as a result, which indicates that we would need 8 times more time to sort a list of 40 elements, compared to a list of 5 elements.

You can get more information about lists at this link:

brainly.com/question/4757050

5 0
2 years ago
Change 'What do they do' into passive voice​
Ivan
What they do is the answer
7 0
3 years ago
Read 2 more answers
Other questions:
  • Why is driving a privilege?
    15·2 answers
  • A Narrative Statement illustrates how your life will look when you reach a goal.
    15·2 answers
  • The Internet shopping cart is an example of which version of the web?
    15·1 answer
  • What do the letters of the su command stand for? what can you do with su besides give yourself root privileges? "what can you do
    5·1 answer
  • Why is it a good idea to leave an interview being courteous and polite?
    10·1 answer
  • Your friend's job pays $5.00 per hour, and he works 20 hours per week. His tax rate is 20 percent. Assuming he works 50 weeks of
    11·2 answers
  • Select the correct word to complete the sentence
    11·2 answers
  • Which type of infrastructure service stores and manages corporate data and provides capabilities for analyzing the data
    12·1 answer
  • Differentiate between patent and copyright.
    6·2 answers
  • Which of the following is an example of an incremented sequence?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!