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
masya89 [10]
4 years ago
10

The list method reverse reverses the elements in the list. Define a function named reverse that reverses the elements in its lis

t argument (without using the method reverse!).
Computers and Technology
1 answer:
Alisiya [41]4 years ago
7 0

Answer:

public class Reverse {

  1.    public static void reverseList(int list [], int n)
  2.    {
  3.        int[] reversedList = new int[n];
  4.        int k = n;
  5.        for (int i = 0; i < n; i++) {
  6.            reversedList[k - 1] = list[i];
  7.            k = k - 1;
  8.        }
  9.        //printing the reversed list
  10.        System.out.println("The Reversed list \n");
  11.        for (int j = 0; j < n; j++) {
  12.            System.out.println(reversedList[j]);
  13.        }
  14.    }

Explanation:

Using Java, An array is implemented to hold a list of items

A method reverseList() is created to accept an array as parameter and using a for statement reverses the elements of the array and prints each element of the list

See below a complete code with a main method that calls this method

<em>public class Reverse {</em>

<em>    public static void main(String[] args) {</em>

<em>        int [] arr = {10, 20, 30, 40, 50};</em>

<em>        reverseList(arr, arr.length);</em>

<em>    }</em>

<em>    public static void reverseList(int list [], int n)</em>

<em>    {</em>

<em>        int[] reversedList = new int[n];</em>

<em>        int k = n;</em>

<em>        for (int i = 0; i < n; i++) {</em>

<em>            reversedList[k - 1] = list[i];</em>

<em>            k = k - 1;</em>

<em>        }</em>

<em>        //printing the reversed list</em>

<em>        System.out.println("The Reversed list \n");</em>

<em>        for (int j = 0; j < n; j++) {</em>

<em>            System.out.println(reversedList[j]);</em>

<em>        }</em>

<em>    }</em>

<em>}</em>

You might be interested in
Can someone help me out? I need to know what is 1 example of computer hacking?
cricket20 [7]
One way to know if someone is hacking you r computer is if you give them all the information about you. and they start texting and saying will you go n a date with me. And . then that person gets it and says: who is hacking into my computer. That is how you know someone  is hacking into your computer. The reason why is i saw a show who did that once. And plus I do my reasearch so I would know this anyway
6 0
4 years ago
Calculate the weighted grade for each student that appears in the data file. You may calculate the grade based on total earned p
lutik1710 [3]

Answer:

I don't know the answer, sorry

6 0
3 years ago
Advantage of internet to millennials​
Nutka1998 [239]
Benefits of Millennials – Networking Millennials, being constantly active on various social media platforms, are more connected and exposed to greater networks. Give them 10 minutes and they will be able to reconnect with the majority of their primary, secondary and tertiary school connections along with previous colleagues
8 0
3 years ago
Read 2 more answers
To create an Order template class object named backOrder and assign 0 as the
Kryger [21]

Answer:

The answer to this question is option c

Explanation:

In this question the correct is option c because, In the java when we create the object of the class. The default constructor will automatically call and it doesn't take any arguments. But In this question we use the parameterized constructor because it take the argument and the correct way for assign the is Order (backOrder(0);) that is option C.

5 0
3 years ago
_____ CRM systems are hosted by an external vendor in the vendor's data center.
PtichkaEL [24]

Answer: On- demand

Explanation:

 On demand CRM system are basically hosted by the external vendor in the vendor data center. CRM is basically stand for customer relationship management.

CRM is a strategy that are used for managing the organisation relationship with the customers.

On demand CRM define as software availability for the customers. It basically connected with the idea of software on demand. The software are modify according to the current requirement and demand.

8 0
3 years ago
Other questions:
  • ____ is a generic term for "evil software." threat worm virus malware
    9·1 answer
  • Propane also known as LP gas, is often mixed with about _______ percent of other gases, such as butane, propylene, and mercaptan
    13·1 answer
  • What does the action tool allow you to do in Microsoft Powerpoint?
    15·1 answer
  • When a person devises the idea for the venture, develops a business plan, uses savings or loans to acquire other resources and a
    9·1 answer
  • Chief technology officers typically earn more working for private companies than for schools or universities.
    15·2 answers
  • When you first launch presentation software, how many blank slides will appear on your screen?
    5·2 answers
  • if someone has become very attached to their mobile device and feels anxious if the cannot connect to the internet, what are the
    7·1 answer
  • Which Excel function or tool will you use to display the cells that are referred to by a formula in the selected cell
    8·1 answer
  • How to save an edited document.​
    6·1 answer
  • What do both wireless lans (wlans) and wireless wans (wwans) rely on as the communication medium?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!