CPSC 233 Lecture 7: 8Feb

29 views3 pages

Document Summary

If you don"t supply a constructor, a default no-arg constructor is provided automaically: it does nothing; equivalent to: public class complex { public complex() { This can be used to send a self reference to another object: eg: Where 2 or more methods have the same name but diferent signatures: signature: the method name plus the parameter list. This return type is not part of the signature. Allows you to give the same name to related methods. The compiler uses signature matching to determine which method to call: eg: public class mymath public static double square(double x) return x*x; public static int square(int x) return x*x; //client code int i=5,j; double d=3. 6,e; j=mymath. square(i); e=mymath. square(d); An object may eventually be garbage collected once all references to the object are eliminated: done at the gc"s discreion, you can usually force garbage collecion with: Is invoked by the system just before an object is garbage collected: you can"t call inalize() directly.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents