CSE 8A Study Guide - Final Guide: Infinite Loop, Negative Number, Steganography

161 views11 pages

Document Summary

Objects are created whenever the new keyword is used. 2 objects are created in the code above jose is an object reference, and is not an object. Turtle jose = new turtle(100, 50, world1); maria = jose; // points maria at the turtle object that jose points to maria. forward(50); // maria and jose point to the same turtle object moves same turtle jose. turn(90); jose. forward(150); // in picture. java public picture copyregiontonew(int xsource, int ysource, intxtarget, int ytarget) Pixel spixel, tpixel = null; for(int sx = xsource, tx = xtarget; sx < 100+xsource; sx++, tx++) for(int sy = ysource, ty = ytarget; sy < 100+ysource; sy++, ty++) { spixel = this. getpixel(sx, sy); tpixel = newcanvas. getpixel(tx, ty); tpixel. setcolor(spixel. getcolor()); Picture newcanvas = fish. copyregiontonew(10, 30, 50, 50); newcanvas. show(); Answer is a this code will not compile: pi(cid:272)ture (cid:374)e(cid:449)ca(cid:374)(cid:448)as = fish. (cid:272)opyregio(cid:374)tone(cid:449)(cid:894) (cid:895) is the line that will cause this code to not even compile.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers