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
Construct a SQL query that displays a list of colleges, their sity/state, the accrediting agency, and whether or not the school
Alex787 [66]

Answer:

SELECT college, city_state, accre_agency, distance LIMIT 10

Explanation:

Given

Table name: College

See attachment for table

Required

Retrieve top 10 college, state, agency and school distance from the table

To retrieve from a table, we make use of the SELECT query

The select statement is then followed by the columns to be selected (separated by comma (,))

So, we have:

SELECT college, city_state, accre_agency, distance

From the question, we are to select only first 10 records.

This is achieved using the LIMIT clause

i.e. LIMIT 10 for first 10

So, the complete query is:

SELECT college, city_state, accre_agency, distance LIMIT 10

6 0
3 years ago
Question 17 (3 points)
Archy [21]

Answer:

#

Explanation:

6 0
3 years ago
The ________________ Act requires Internet sales to be treated in the same way as mail-order sales (e.g., collect sales tax from
BARSIC [14]

Answer:

Internet Tax Freedom Act

Explanation:

The Internet Tax Freedom Act was signed into law in 1998 by President Bill Clinton and has since been reviewed until the Permanent Internet Tax Freedom Act was passed into law on the 9th of June, 2015 by President Barrack Obama.

The Act requires that internet sales are equally treated as mail-order sales.

5 0
3 years ago
Which of these improved the ability to send information over the network in the 1970s?
frez [133]

Answer:

b. ethernet

Explanation:

It was an ethernet that was developed in the 1970s that improved the ability to send the information over the network. It is the most widely used method to connect the computers in a LAN or the local area network, ever since 1980 when it was first introduced for commercial use. And it is being used in bulk even today.

4 0
3 years ago
The ______ view connects perceptual capabilities to information available in the world of the perceiver. Multiple choice questio
jekas [21]

Answer:

Ecological

Explanation:

Please mark brainliest

4 0
2 years ago
Other questions:
  • The BIOS feature that enables a hard drive to read or write several sectors at a time is called what?
    5·1 answer
  • You support Richman Investments, a brokerage firm that employs 20 brokers. Each broker has his own client computer, and the firm
    15·1 answer
  • To construct a battery with a current of 6 A, you would connect six 1 A cells
    9·1 answer
  • What linux command is used to change file permissions?
    10·1 answer
  • Website administrators relay on ______, which is data such as the number of users who commented on, shared, viewed, or liked web
    7·2 answers
  • Is the following a true statement in our world? Why or why not?
    13·1 answer
  • A final class can't be extended.TrueFalse
    5·1 answer
  • Why when I put a question in the search bar it says something went wrong?
    9·1 answer
  • Why is dark supereffective against ghost?
    5·2 answers
  • Which of these number formats would you want to apply to a cell showing the total sales for the month? Currency, Number, or Perc
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!