Problem 4
public void swapHardDrive(Computer otherComputer) { String temp; temp = this.hardDrive; this.hardDrive = otherComputer.hardDrive; otherComputer.hardDrive = temp; }
Problem 12
Things in bold are output
- Contructore without parameter is called
- It calls the constructor with an int parameter of 20
- 10
- 20
- Sets private x value to 30
- 30
- Display without an argument is called
- Calls display with an argument set at 50
- Adds 10 to it so now its 60
- 60
- Prints the old x value since non objects are passed by value.
- 50