|
RHS |
Test 02
Your name: _________________________________________________
| Question 1 | |||
Assume that the following method is declared:
Which of the following return-statements are valid for the method (note: more than one answer can be correct)?
|
|||
|
|||
| Question 2 | |||
|
Which of the following declarations are constructors (note: more than one answer can be correct):
|
|||
|
|||
| Question 3 | |||
Below is a class, MobilePhone, to represent a mobile phone. It holds two instance variables, phoneNumber (a String) and PINcode (an int). Also there is two constructors: one with no parameters (setting some default values) and one that takes two parameters (phoneNumber and PINcode). Both constructors and methods have some documentation. public class MobilePhone { /** Creates a new instance of MobilPhone with default values /** Creates a new instance of MobilPhone with values from parameters /** Sets (overwrites) the value for the phoneNumber /** Reads and returns the value for the phoneNumber /** Sets (overwrites) the value for the PINcode /** Reads and returns the value for the PINcode //Instance variables
Create the two methods toString() and equals(). |
|||
|
|||
| Question 4 | |||
Assume that the following lines are executed:
What will be printed on the screen after the following lines of code has been executed?
|
|||
|
|||