Computer Science 1026A/B Chapter : Computer Science 1026 Topic 11.docx

52 views2 pages
terubarenuka and 39895 others unlocked
COMPSCI 1026A/B Full Course Notes
26
COMPSCI 1026A/B Full Course Notes
Verified Note
26 documents

Document Summary

Previous return value methods: getwidth(): returns an integer, getpixel(): returns the reference to a pixel object, getpixels(): returns the reference to an array of pixels. The return statement sends the specified value back to where the method was invoked. The return type must be specified in the method header (replaced by void") Pixel pixelobj = this. getpixel(x,y); if (pixelobj. getred()==255 && pixelobj. getgreen()==255 && pixelobj. getblue() == 255) A return value can also be a boolean value (true or false). Equal size method: picture class method that checks whether the two pictures are of the same size, one picture invokes the method, and another is used as a parameter for the method. If the picture objects are of the same size, return true. Return (this. getwidth() == otherpic. getwidth() && this. getheight() == otherpic. getheight()); Previously, picture class methods were invoked on a target picture object. It is possible to create a new target picture object inside a method, and return it as the result of the method.

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

Related Questions