Question: What is output? public static void swap ( int val 1 , int val 2 ) { int temp; temp = val 1 ; val

What is output?
public static void swap(int val1, int val2){
int temp;
temp = val1;
val1= val2;
val2= temp;
}
public static void main(String[] args){
int x;
int y;
x =10;
y =20;
swap(x, y);
System.out.println(x +","+ y);
}
Question 24Answer
a.
10,20
b.
10,10
c.
20,10
d.
20,20

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!