Question: AP Computer Science- Inheritance Worksheet 2 DIRECTIONS: Fill in each blank with the correct answer. Assume each statement happens in that one statement may affect
AP Computer Science- Inheritance Worksheet 2 DIRECTIONS: Fill in each blank with the correct answer. Assume each statement happens in that one statement may affect the next statement. Some sections might print more than once. Write ERR for any segments that cause errors. (Refer to Moodle to WS1) class G private int x public GOIX 3:1 public void setx(int val x vali public String tostring) return +x class H extends G private int y: public Hoy: public oid seer tint val){ y-vali return y "+super.toString) IILIAIAIAIIIAINM //test code in the main method G one new GO; out.printin(one) one.setX(5) out.printin(one) H two- new H) two.setx (-2) two.setY(11) out.printin(two) G three new H0 out printinithree) three.setx(8) three.setY (21)1 out.printinfthree): G four -new ) four.setX (11): out.println (four) four.setx(6) t (H) four) setY (i4 out.printin(four) 3. H five new Rt) five.setY (7) out.printin(Eive); ive.setx(16) five.setY (9) out.printin(five): C A+ Computer Science-Worksheet- www.apluscompsci.com
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
