Presentation is loading. Please wait.

Presentation is loading. Please wait.

References, Objects, and Parameter Passing

Similar presentations


Presentation on theme: "References, Objects, and Parameter Passing"— Presentation transcript:

1 References, Objects, and Parameter Passing
Data Structures

2 public class X { public int value;
public static void bah(X d, X e) { X f = d; f.value = f.value+1; X g = new X(); g.value = e.value+1; e = g; } public static void main(String args[]) { X a = new X(); a.value = 1; X b = new X(); b.value = 10; X c = a; c.value = 5; bah(a,b); System.out.println(a.value + ", " + b.value + ", " + c.value);} }

3 public class X { public int value;
public static void bah(X d, X e) { X f = d; f.value = f.value+1; X g = new X(); g.value = e.value+1; e = g; } public static void main(String args[]) { X a = new X(); a.value = 1; X b = new X(); b.value = 10; X c = a; c.value = 5; bah(a,b); System.out.println(a.value + ", " + b.value + ", " + c.value);} }

4 public class X { public int value;
public static void bah(X d, X e) { X f = d; f.value = f.value+1; X g = new X(); g.value = e.value+1; e = g; } public static void main(String args[]) { X a = new X(); a.value = 1; X b = new X(); b.value = 10; X c = a; c.value = 5; bah(a,b); System.out.println(a.value + ", " + b.value + ", " + c.value);} }

5 public class X { public int value;
public static void bah(X d, X e) { X f = d; f.value = f.value+1; X g = new X(); g.value = e.value+1; e = g; } public static void main(String args[]) { X a = new X(); a.value = 1; X b = new X(); b.value = 10; X c = a; c.value = 5; bah(a,b); System.out.println(a.value + ", " + b.value + ", " + c.value);} }

6 public class X { public int value;
public static void bah(X d, X e) { X f = d; f.value = f.value+1; X g = new X(); g.value = e.value+1; e = g; } public static void main(String args[]) { X a = new X(); a.value = 1; X b = new X(); b.value = 10; X c = a; c.value = 5; bah(a,b); System.out.println(a.value + ", " + b.value + ", " + c.value);} }

7 public class X { public int value;
public static void bah(X d, X e) { X f = d; f.value = f.value+1; X g = new X(); g.value = e.value+1; e = g; } public static void main(String args[]) { X a = new X(); a.value = 1; X b = new X(); b.value = 10; X c = a; c.value = 5; bah(a,b); System.out.println(a.value + ", " + b.value + ", " + c.value);} }

8 public class X { public int value;
public static void bah(X d, X e) { X f = d; f.value = f.value+1; X g = new X(); g.value = e.value+1; e = g; } public static void main(String args[]) { X a = new X(); a.value = 1; X b = new X(); b.value = 10; X c = a; c.value = 5; bah(a,b); System.out.println(a.value + ", " + b.value + ", " + c.value);} }

9 public class X { public int value;
public static void bah(X d, X e) { X f = d; f.value = f.value+1; X g = new X(); g.value = e.value+1; e = g; } public static void main(String args[]) { X a = new X(); a.value = 1; X b = new X(); b.value = 10; X c = a; c.value = 5; bah(a,b); System.out.println(a.value + ", " + b.value + ", " + c.value);} }

10 public class X { public int value;
public static void bah(X d, X e) { X f = d; f.value = f.value+1; X g = new X(); g.value = e.value+1; e = g; } public static void main(String args[]) { X a = new X(); a.value = 1; X b = new X(); b.value = 10; X c = a; c.value = 5; bah(a,b); System.out.println(a.value + ", " + b.value + ", " + c.value);} }

11 public class X { public int value;
public static void bah(X d, X e) { X f = d; f.value = f.value+1; X g = new X(); g.value = e.value+1; e = g; } public static void main(String args[]) { X a = new X(); a.value = 1; X b = new X(); b.value = 10; X c = a; c.value = 5; bah(a,b); System.out.println(a.value + ", " + b.value + ", " + c.value);} }

12 public class X { public int value;
public static void bah(X d, X e) { X f = d; f.value = f.value+1; X g = new X(); g.value = e.value+1; e = g; } public static void main(String args[]) { X a = new X(); a.value = 1; X b = new X(); b.value = 10; X c = a; c.value = 5; bah(a,b); System.out.println(a.value + ", " + b.value + ", " + c.value);} }

13 public class X { public int value;
public static void bah(X d, X e) { X f = d; f.value = f.value+1; X g = new X(); g.value = e.value+1; e = g; } public static void main(String args[]) { X a = new X(); a.value = 1; X b = new X(); b.value = 10; X c = a; c.value = 5; bah(a,b); System.out.println(a.value + ", " + b.value + ", " + c.value);} }

14 public class X { public int value;
public static void bah(X d, X e) { X f = d; f.value = f.value+1; X g = new X(); g.value = e.value+1; e = g; } public static void main(String args[]) { X a = new X(); a.value = 1; X b = new X(); b.value = 10; X c = a; c.value = 5; bah(a,b); System.out.println(a.value + ", " + b.value + ", " + c.value);} }

15 public class X { public int value;
public static void bah(X d, X e) { X f = d; f.value = f.value+1; X g = new X(); g.value = e.value+1; e = g; } public static void main(String args[]) { X a = new X(); a.value = 1; X b = new X(); b.value = 10; X c = a; c.value = 5; bah(a,b); System.out.println(a.value + ", " + b.value + ", " + c.value);} }

16 public class X { public int value;
public static void bah(X d, X e) { X f = d; f.value = f.value+1; X g = new X(); g.value = e.value+1; e = g; } public static void main(String args[]) { X a = new X(); a.value = 1; X b = new X(); b.value = 10; X c = a; c.value = 5; bah(a,b); □ System.out.println(a.value + ", " + b.value + ", " + c.value);} }

17 public class X { public int value;
public static void bah(X d, X e) { X f = d; f.value = f.value+1; X g = new X(); g.value = e.value+1; e = g; } public static void main(String args[]) { X a = new X(); a.value = 1; X b = new X(); b.value = 10; X c = a; c.value = 5; bah(a,b); System.out.println(a.value + ", " + b.value + ", " + c.value);} }


Download ppt "References, Objects, and Parameter Passing"

Similar presentations


Ads by Google