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
Nookie1986 [14]
3 years ago
12

Write a program whose input is two integers and whose output is the two integers swapped. Place the values in an array, where x

is position 0 and y is position 1. Ex: If the input is: 3 8 then the output is: 8 3 Your program must define and call a method: public static void swapValues(int[] values)
Computers and Technology
1 answer:
Aliun [14]3 years ago
7 0

Answer:

import java.util.Arrays;

public class swap{

   public static void main(String []args){

       int [] arr = {2,4};

       swapValues(arr);

   }

   public static void swapValues(int[] values){

       int temp;

       System.out.println(Arrays.toString(values));

       temp=values[0];

       values[0]=values[1];

       values[1] =temp;

       System.out.println(Arrays.toString(values));

   }

}

Explanation:

In the program above, we created the method swapValues that receives an array of integers as parameters. in the method definition, we created a temp variable that is used to swapp the element at index 0 and index 1. Java's Arrays.to string method is used to print the array before and after the swap.

You might be interested in
Please help me i need rn please help​
boyakko [2]

Answer: uty ute reb

Explanation:

3 0
2 years ago
What is instant messaging
SpyIntel [72]
Instant messaging (IM) is a type of communication where one person can send a message (typically text based) and have another (1 or more) recipient receive the message.
6 0
3 years ago
I came here for a answer so why did i get a pep talk
Llana [10]

Answer:

idek my guy

Explanation:

6 0
3 years ago
Read 2 more answers
Learning design software, applying to college and creating a website to showcase work are examples of _____________ that lead to
mariarad [96]

Answer:

Web designer

Explanation:

A Web designer is someone who knows about some programming languages like HTML, CSS or JavaScript, but in website development, there are two main areas, in this case, Front-End and Back-End.

A web designer uses Front-End because it only elaborates on the system's view and all about the view for the users.

7 0
4 years ago
The ____ is the ranking executive on-site when the crisis or emergency arises, who is authorized to initiate the CM plan.
aleksklad [387]

The answer is the Executive-in charge

The concept of an Executive-in charge came from the military’s chain of command. A chain of command ranges from a supervisor to the top executive of the organization. When a crisis arises, it is possible that one or more of the senior top managers may not be available for consultations because of the travel-intensive positions.






7 0
3 years ago
Read 2 more answers
Other questions:
  • Silver, lead, and hydrogen are examples of what type of matter?
    12·1 answer
  • You can increase your efficiency by using your e-mail program's spell checker because it eliminates the need for you to proofrea
    11·1 answer
  • A rich text format (RTF) provides an electronic image of a document and can be viewed, printed, and electronically transmitted.
    7·1 answer
  • How many unique ip addresses can be made in a fixed-length ip address system using 6 bits?
    8·1 answer
  • A comma is also called a statement terminator. A. True B. False
    8·1 answer
  • Your boss asks you to transmit a small file that includes sensitive personnel data to a server on the network. The server is run
    9·1 answer
  • What do u think a creative app must have? <br><br> Please answer the question ASAP!!
    5·1 answer
  • Think of a genre (science, music, math, sports, video games, etc.) and create at least 10 questions. You can decide whether you
    12·2 answers
  • Which job qualifications are typical for someone who wants to work in Information Support and Services?
    8·2 answers
  • Text to appear
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!