generated from ZipCodeCore/OldTexasCode2
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathPrimitiveParameters.java
More file actions
33 lines (30 loc) · 933 Bytes
/
PrimitiveParameters.java
File metadata and controls
33 lines (30 loc) · 933 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
public class PrimitiveParameters
{
public static void main(String[] args)
{ go();
}
public static void go()
{ int x = 3;
int y = 2;
System.out.println("In method go. x: " + x + " y: " + y);
falseSwap(x,y);
System.out.println("in method go. x: " + x + " y: " + y);
moreParameters(x,y);
System.out.println("in method go. x: " + x + " y: " + y);
}
public static void falseSwap(int x, int y)
{ System.out.println("in method falseSwap. x: " + x + " y: " + y);
int temp = x;
x = y;
y = temp;
System.out.println("in method falseSwap. x: " + x + " y: " + y);
}
public static void moreParameters(int a, int b)
{ System.out.println("in method moreParameters. a: " + a + " b: " + b);
a = a * b;
b = 12;
System.out.println("in method moreParameters. a: " + a + " b: " + b);
falseSwap(b,a);
System.out.println("in method moreParameters. a: " + a + " b: " + b);
}
}