Address toString()
source link: http://programmingbydoing.com/a/address-tostring.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
- Author: Graham Mitchell
- Filename: AddressToString.java
Address toString()
If you want, you can add a toString()
method to a record. The function should return a String
showing how the record should be
printed. Using a toString()
method makes printing
records much easier.
What You Should See
1. 191 Marigold Lane, Miami 33179 2. 3029 Losh Lane, Crafton 15205 3. 4939 Holt Street, Lake Worth 33463 4. 2693 Hannah Street, Hickory 28601 5. 4880 Carter Street, Fairview Heights 62208
Files Needed
What You Should Do on Your Own
Assignments turned in without these things will receive half credit or less.
What happens if the function is renamed from
toString()
to something else? Answer in a comment, then change it back.- The
toString()
method given does not display the state field. Fix it so that it does.
©2013 Graham Mitchell
This assignment is licensed under a
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK