Computer Science, asked by kosugutiaxom, 20 hours ago

write a java program to intialize two integer variables a and b with 5 and 6 , respectively ,and interchange them .Thus after, interchanging,a and b will be 6 and 5, respectively​

Answers

Answered by simonsaikia9
1

Answer:

public class Interchange{

public static void main(String[] args)

{

int a = 5, b = 6;

System.out.println("Before Interchanging");

System.out.println("a = " + a);

System.out.println("b = " + b);

int temp = a;

a = b;

b = temp;

System.out.println("After Interchanging");

System.out.println("a = " + a);

System.out.println("b = " + b);

}

}

Similar questions