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 to transfer bookmarks to new computer
Romashka-Z-Leto [24]

Explanation:

On your computer, open Chrome

.At the top right, click More

.Select Bookmarks Import Bookmarks and Settings

.Select the program that contains the bookmarks you'd like to import.Click Import.

Click Done

3 0
3 years ago
Which data type is also called a binary object?
Andrej [43]
Binary large objects(BLOb):this data type is also called a binary object, and its fields are called binary fields.
7 0
3 years ago
Read 2 more answers
Software that protects confidentiality by screening outgoing documents to identify and block transmission of sensitive informati
GarryVolchara [31]

Answer:

d. Data Loss Prevention (DLP)

Explanation:

Data Loss Prevention (DLP) -

It refers to the type of strategy , where any sensitive or personal information can not be leaked out in the corporate network , is referred to as data loss prevention .

There are various software products that help to save the data , by controlling the information shared by the users .

The method is important for any business .

Hence , from the given scenario of the question ,

The correct answer is d. Data Loss Prevention (DLP) .

7 0
3 years ago
Joe always misspelled the word calendar what function corrects the word
Lostsunrise [7]

Answer: Auto correct

6 0
4 years ago
Read 2 more answers
I need this ASAP anyone pleas help me i have to do this by tonight
tigry1 [53]

Answer:

IDk

Explanation:

8 0
3 years ago
Other questions:
  • Which osi layer is responsible for combining bits into bytes and bytes into frames?
    8·1 answer
  • Which button would you use to quickly add addresses to a mail merge envelope?
    5·1 answer
  • Sarah, a computer user, tells James, a computer technician, that the network she is connected to is running too slowly. Which of
    5·1 answer
  • 3. Which one of the following statements is correct? _____ variables are those whose storage bindings are created when their dec
    12·1 answer
  • If you could make another device "smart" and have
    12·1 answer
  • Which computer component are you most like? Explain why.
    10·1 answer
  • Design 3 classes: Computer - Superclass
    11·1 answer
  • Whate is function of northe bridge<br>​
    12·1 answer
  • What are 3 examples of a idler gear in real life?
    7·1 answer
  • The average American has 10 devices, ask for users average number of devices. Any number between 7 and 12 will print “you have a
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!