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
Angelina_Jolie [31]
4 years ago
7

Assume that x and y are integer variables that have been initialized to 20 and 10, respectively. What is the output of the follo

wing code segment? System.out.println( x + "\t" + y ); swap( x, y ); System.out.println( x + "\t" + y ); public static void swap( int a, int b ) { if( a > b ) { int temp = b; b = a; a = temp; } System.out.println( a + "\t" + b ); }
Computers and Technology
1 answer:
ad-work [718]4 years ago
8 0

Answer:

// here is the complete code in java to check the output.

import java.util.*;

class Main

{

public static void main (String[] args) throws java.lang.Exception

{

   try{

       int x=20,y=10;

       System.out.println( x + "\t" + y );

       swap( x, y );

       System.out.println( x + "\t" + y );

   }catch(Exception ex){

       return;}

}

public static void swap( int a, int b )

{

    if( a > b )

    {

        int temp = b;

        b = a;

        a = temp;

        }

        System.out.println( a + "\t" + b );    

}

}

Explanation:

Here is "x" is initialize with 20 and "y" is with 10. The first print statement  will print the value of "x" and "y"  separated by a tab. Then it will the swap() method with parameter x and y.In the swap method, if first parameter is greater then it will swap the two value and the print statement will execute. It will print 10 and 20 separated by a tab. then in the main method, print statement execute And print the value of x,y as 20 and 10. Here value of x, y will not change by the method swap() because in java parameters are passed by value not by reference.That is why  any change by swap() method will not reflect in the main method.

Output:

20      10                                                                                                                                                    

10      20                                                                                                                                                    

20      10

You might be interested in
What is the condition for setting an alarm clock
stich3 [128]

Answer:

The time in which the alarm clock will sound

Explanation: Hope this helped please give me brainliest

6 0
3 years ago
This morning when Paul turned on his computer at work, it would not boot. Instead, Paul reported that he heard a loud clicking n
IRISSAK [1]

Answer:

The problem with Paul's computer is that the magnetic hard drive failed.

Explanation:

A magnetic hard drive or hard disk is a non-volatile storage device, which is used to store different information on a computer.

The magnetic disk is made up of numerous magnetic plates, these plates are divided into sectors and tracks. A spindle is present in the middle to rotate the combined plates or the whole unit.

When there is a clicking noise coming from the magnetic disk, it could mean that one of the plates is damaged or if the power to the computer is inconsistent. This can greatly affect the performance of your computer.

3 0
4 years ago
Randy is concerned about his company’s data security on the Internet. Because cellular signals are not encrypted, he is concerne
Misha Larkins [42]

Answer:

By using a virtual private network (VPN)

Explanation:

If Randy deploys a virtual private network (VPN), it will give the sales department online privacy since VPN encrypt connections whenever the sales department connects to the company network over the Internet. A VPN for the sales department is very necessary to use over a cellular data signal to ensure the department's overall digital defense, and it also has other uses.

7 0
3 years ago
Install hardware, install software, and convert data are the three steps found in the _____. Select one:
aev [14]

Answer:b)Conversion plan.

Explanation:Conversion plan is type of plan in which the the technique is followed by converting the data from the present system to another system's hardware and software surroundings.

The technique follows three basic steps in the conversion plan is software installation plan, hardware installation plan and conversion of data. Thus the correct option is option(b).

3 0
4 years ago
Paano mo maipapamalas na ikaw ay may malusog na kaisipan​
LenaWriter [7]
Okokokokokok okok ok
5 0
3 years ago
Other questions:
  • A help desk manager needs to know the
    15·1 answer
  • What formula would you enter to add the values in cells b4, b5, and b6?
    10·1 answer
  • Which concept often comes in conflict with privacy rights?
    14·1 answer
  • JAVA Question!
    13·1 answer
  • All the read/write heads a hard disk are controlled by a(n) ____ which moves the read/write heads across the disk surfaces in un
    13·1 answer
  • If you used a peach as a model of an animal cell, what would the peach's skin represent? A.nucleus B.cell wall C.cytoplasm D.cel
    10·2 answers
  • For a loop counter, the appropriate data type would be:
    9·1 answer
  • Dealing with stress and strong emotions centeral idea​
    6·2 answers
  • How can you make your MakeCode micro:bit program display either the letter<br> A or the letter B?
    11·1 answer
  • What type of dns servers field dns queries, send iterative queries to upstream dns servers, or send requests to forwarders and t
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!