We started class by looking at HW#1 and talking about what I expected for full credit.
We continued by looking at HW#2 and talking about some of the details of both the assignment and assignments in general (using the homework submission system).
public class MemoryDemo
{
public static void main(String[] args)
{
int x;
int y;
x=5;
y=x;
y++;
System.out.println("x="+x);
System.out.println("y="+y);
WesternTown town1;
WesternTown town2;
town1 = new WesternTown();
town2 = town1;
town2.increaseTrouble();
System.out.println("town1="+town1.troubleCount());
System.out.println("town2="+town2.troubleCount());
}
}
(You will need a version of WesternTown.java to run this)
What do you think will happen?
Why?
Now, what if I add in:
String a="Hello"; String b=a; b="Goodbye"; System.out.println(a); System.out.println(b);
Discussion Points