225_04_recurrence - public class Test cfw_ int data; public...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
1 public class Test { int data; public Test(int x ) { data=x; } public void assign(Test b, Test c, int d) { data= 2; b= new Test(2); c.data= 2; d=2; } public static void main(String [] args) { Test a, b, c; int d; a= new Test(1); b= new Test(1); c= new Test(1); d=1; a.assign(b, c, d); System.out.println(a.data + " " + b.data + " " + c.data + " " + d); } } What does this  print?
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 public class Test { int data; public Test(int x ) { data=x; } public void assign(Test b, Test c, int d) { data= 2; b= new Test(2); c.data= 2; d=2; } public static void main(String [] args) { Test a, b, c; int d; a= new Test(1); b= new Test(1); c= new Test(1); d=1; a.assign(b, c, d); System.out.println(a.data + " " + b.data + " " + c.data + " " + d); } } On slides: I may use awkward spacing in order to allow  visibility/increased font size. Please format your code nicely!
Background image of page 2
3 You will learn a lot more if you try the problems and get them wrong than if you do not  try. Also, it helps me know where the class is in terms of understanding.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 Office hours: Tuesdays: 12:30-1:30, 2:30-3:20.
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/15/2012 for the course CSC 225 taught by Professor Valerieking during the Spring '10 term at University of Victoria.

Page1 / 7

225_04_recurrence - public class Test cfw_ int data; public...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online