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
ENG103 DISCUSSION BOARD 6
amm1812
The proper citation for your course of study -computer related- is APA (American Psychological Association)  format. This citation format allows us to state the publication date, title , and authors in an organized and short fashion. All scholarly reports that are technology or psychology based, should be cited in APA format. 

<span>I know this because it is the format I use for all of my college courses which are all Computer/Technology related. </span>
3 0
3 years ago
Por qué el entorno gráfico de Windows es amigable con el hombre ?
elena-14-01-66 [18.8K]

Explanation:

Por que es un sistema diseñado para ayudar a las personas de forma amable

ESPERO Y TE AYUDE ;)

3 0
3 years ago
Question
LuckyWell [14K]

Answer:

you go to the what ever you use for the stuff i thing you want

Explanation:

6 0
3 years ago
12. In Justify the text is aligned both to the right and to the left margins, adding extra space between words as necessary *
Lena [83]

\blue{

\green{

Answer:

  • False

Explanation:

  • Because, aligment the tex are aligned in the centre of the page.

\pink{

\red{

4 0
3 years ago
Read 2 more answers
Pls guys I need help fast my PC is new and it can't connect to a network
nata0808 [166]

Answer:

There are several reasons why your PC might not be able to connect to Wi-Fi. You should first make sure that your PC's Wi-Fi adapter hasn't been turned off, or needs to be reset. The issue might also be with the Wi-Fi, not your PC — make sure that it works on other devices.

8 0
2 years ago
Other questions:
  • Which of the following careers is part of the Printing Technology pathway?
    10·1 answer
  • A company has a network printer that is utilzed by several departments. Although the printer shows online and other departments
    11·1 answer
  • Write a main method that prompts the user for an integer between 1 &amp; 20 (inclusive). If the user enters an invalid number, p
    8·1 answer
  • Which type of storage disk and disk drive can be used in the given situation? Amy wants to borrow an interesting movie from Bruc
    10·2 answers
  • The first thing you must consider in any type of communication is ______.
    9·2 answers
  • Choose the reasons why Windows Server operating systems are a popular choice for a network because they _____. Select all that a
    12·1 answer
  • An input value has to be greater than 18 and less than 65 if a driving license is to be approved for issue. What type of input c
    11·1 answer
  • What method do phishing and spoofing scammers use
    12·1 answer
  • Autocad has _____ different ways to use the three point method if drawing and arc
    8·1 answer
  • So has anyone opened the link/file those people are giving out as answers? Like what are they, viruses, answers, nothing??? Some
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!