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
How does social media affect communication skills negatively?
AnnZ [28]
How social media affects communication negatively
The following are the ways in which social media affects communication negatively
1)Internet-the internet has made it easier to communicate too much use can result to addiction . Internet addiction make most of youths skip vital activities like homework,social activities among others. 
2)Text messages-The use of instant messaging has become popular especially among teens.Use of symbols such as emojis and abbreviated words has made many people to become too cusual on language use.
The use of fewer syllables and shorter words is likely to make teens leave out important aspects of verbal communication and may lead to misinterpretation of messages.
3)Dialogue-  Internet communication mostly takes place in the written form as opposed to the spoken form. Teens primarily communicate through textual posts,emails e.t.c all of which are in the written form.
Since written communication typically occurs in form of monologue, teens addicted to the internet may find it difficult to engage in dialogue a feature of verbal communication.For instance they may find it difficult to effectively use aspects of verbal communication such as tonal variation turn taking and speed.
<span>4)Informal language- </span>The use  of informal language is a salient feature of internet communication.This has a negative effect on teens mastery of formal language.
Internet language has features of informal language such as short turn taking, exclusion of auxiliary verbs and pronouns.
This could be due to the reason that teens put more emphasis on speed and efficiency at the expense of grammar.
5)Listening skills-
listening skills is an important aspect of verb communication and effective listening enhances communication.
Effective listening entails being information literate which is the ability to identify which information is needed when it is needed,where to find it, and effectively using it.
4 0
3 years ago
What frequency band is used by bluetooth, 802.11b, and 802.11g?
bagirrra123 [75]
802.11 is a Wi-Fi standard, not a frequency, both of those operate at 2.4 GHz. Bluetooth operates at frequencies between 2402 and 2480 MHz, or 2400 and 2483.5 MHz. 
4 0
3 years ago
Why green office became popular among businesses? ​
Tanzania [10]

Answer:

Going green has several other benefits for companies. These include tax credits and incentives, improved efficiency, healthier workplaces, and cost savings – for instance by printing less, turning lights off in unused rooms and refilling ink cartridges. Reusing items also reduces waste from plastic packaging.

Explanation:

3 0
3 years ago
Read 2 more answers
In excel what is the biggest disadvantage of copying a worksheet into another workbook?
Mariana [72]
The answer might be wrong and you could get caught
7 0
3 years ago
1. You have been contracted to design a system for a smart car. The company installed four laser radars on the car’s corners to
Alexxandr [17]

Answer:

A). Using a flowchart, show the algorithm for the car collision avoidance system.

Explanation:

5 0
2 years ago
Other questions:
  • This information is generally included on a fax cover sheet.
    15·1 answer
  • A small company has hired you to take over its IT needs. The company currently has seven on-site employees and 12 remote employe
    12·1 answer
  • In C please:
    5·1 answer
  • 1. which of the following tools can be used to mesure mass. (answer = 5 +??? points)
    7·2 answers
  • Write a program to complete the task given below: Ask the user to enter any 2 numbers in between 1-10 and add both of them to an
    8·1 answer
  • PLZ HELP ASAP
    13·1 answer
  • How many times do you return after the dateline ?
    12·1 answer
  • By limiting the number of times a person can use a type of software before registering as the authorized owner of that software,
    15·1 answer
  • What does it mean to clear a setting in a dialog box?
    14·1 answer
  • Which type of protocol provides a way to transfer files from one computer to another over any tcp/ip network, such as a lan or t
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!