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
Match the following
kakasveta [241]

Answer:

Eraser tool -removes the unwanted part of the drawing.

Row -horizontal space running from left to right.

Text -Primary component of a multimedia.

Drawing Area -Working are of ms point program.

I hope this helps!! Correct me plz if I'm wrong. If I'm right, could you mark me as brainliest?

8 0
2 years ago
Someone who wants to learn a skilled trade on the job should consider
Alexeev081 [22]
Someone who wants to learn a skilled trade on the job should consider enrolling in class for the knowledge and skills.
5 0
3 years ago
Read 2 more answers
Write a structure declaration to hold the following data about a savings account: Account Number (string object) Account Balance
Citrus2011 [14]

Answer:

Explanation:

The following is written in C and creates a structure declaration named savingsAccount and adds all of the values into it as defined in the question.

struct savingsAccount {

char AccountNumber[] = "";

double AccountBalance;

double InterestRate;

double AverageMonthlyBalance;

}

4 0
3 years ago
Free up disk space by doing____?​
8090 [49]

Answer:

Deleting files and etc on your computer.

6 0
3 years ago
Read 2 more answers
Write a short note on attributes in HTML.<br> If you answer this i will mark you as BRAINLIST
Hunter-Best [27]

Answer:

Explanation:

HTML attributes are a modifier of an HTML element type. An attribute either modifies the default functionality of an element type or provides functionality to certain element types unable to function correctly without them. In HTML syntax, an attribute is added to an HTML start tag.

4 0
2 years ago
Other questions:
  • WILL GIVE BRAINLIEST! I'm doing a project at school. Does anyone have any good explanations for Digital Art? I need it to be at
    13·2 answers
  • A group of accountants encrypt the emails they send to your company because they contain highly sensitive financial information.
    11·1 answer
  • application that will perform a lot of overwrites and deletes of data and requires the latest information to be available anytim
    8·1 answer
  • Do the following SQL questions. The resulting columns must all have descriptive names. You must show the result of the query. Fo
    6·1 answer
  • PLZ ANSWER THESE QUESTIONS FOR 30 POINTS AND BRAINLIEST!
    9·1 answer
  • How do you create multiple columns in Word?
    9·1 answer
  • What is the next line?
    8·1 answer
  • Is Naab a system of an accounting system? A factory operations system? or both? explain your answer
    12·1 answer
  • Sigma Technology is a company based in Singapore, with branches in 24 countries. It needs multiple CAs in different locations to
    6·1 answer
  • What is the difference between a computer’s RAM and its hard disk?
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!