University of Iowa Computer Science Department

Quiz 06


1. A class may have multiple contructors. Define a class named A and write two constructors. The first one takes no parameters and does nothing. The second one takes a single string argument and saves that string argument in an instance variable named "firstName".

2. Assume that you have defined the class Rational to describe a rational number. To find the recriprocal of the Rational number (r1), you make the call r1.Recriprocal(). In the Recriprocal method inside of class Rational, how do you refer to the calling object (i.e., r1)?
UI CLAS CRA ACM Valid CSS! Valid XHTML 1.0 Transitional Level Double-A conformance icon, W3C-WAI Web Content Accessibility Guidelines 1.0 Cynthia tested
| Modified: .