public class Bal1 private double rx, ry: public Ball) { rx = 0.5; ry= 0.5; } 6 p
ID: 3728533 • Letter: P
Question
public class Bal1 private double rx, ry: public Ball) { rx = 0.5; ry= 0.5; } 6 public void move () 9 10 rx = rx + .001; ry = ry + .002; public void move (double vx, double vy) 12 13 14 15 rx = rx + vx; ry = ry + vy; 16 17 18 19 20 21 public static void main (Stringt] args) private double vx, vy: Ball bl = new Ball(); Ball b2 new Ball(); bl.move ) b2.move (vx, vy)i 23 24 In the blanks at left, give all line numbers that contain each of the entities described at rig instance variable declaration constructor signature object creation overloaded method signature method invocation or call primitive type variable declaration reference type variable declaration a. b. d. g.Explanation / Answer
a) line 3 (instance variable declaration or object variable declation)
b) line 4 (constructor signature)
c) line 19 or 20 (both lines are creating Objects of Ball as b1 and b2)
d) line 11 (method void move() and void move(double vx, double vy) are overloaded method signature because of return are same is void, method name are same is move and method arguments are different of method move are called overloaded method)
e) line 21 or 22(method b1.move() and b2.move(vx, vy) are calling, but here Ball object b1 calling only move() no argument methos and other Ball object b2 calling move(vx, vy) method)
f) line 3 or 18 (declared double in line 3 and 18, double is primitive data type)
g) line 19 or 20 (In Java all Object reference variables are reference type variable declaration like here b1 and b2 of Ball Object)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.