This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: ] 4. A Constructor should have same name as the class, should be public , and must not have a return type. Once you start creating constructors, you must also create the default constructor ('cause Java assumes you know what you're doing…) We want to be able to share code between Constructors [ chaining using this ] 5. To chain constructors, simply put this and then the parenthesis with parameters. You can't call other methods before you call the chaining constructor call. How can we print out an object neatly? [ toString() method ] 6. Today: 10-04 Class Notes CS 107 Monday, October 04, 2010 12:08 PM 107 Fall 2010 Page 1 How can we do a deep comparison of objects? [ equals() method ] 7. How can we make a copy of an object? [ copy constructor ] 8. See code developed in class for these. Test your knowledge: How would we create a Book class? What should be in it? How would we create the driver to test it? 107 Fall 2010 Page 2...
View Full Document
- Fall '10
- Computer Programming, Method, Subroutine, Class Notes CS, argument signature