Question: 13. Consider the following code snippet: public class Demo { public static void main(String[] args) { Point[] p = new Point[4]; p[0] = new Colored3DPoint(4,
13. Consider the following code snippet:
public class Demo
{ public static void main(String[] args)
{ Point[] p = new Point[4];
p[0] = new Colored3DPoint(4, 4, 4, Color.BLACK);
p[1] = new ThreeDimensionalPoint(2, 2, 2);
p[2] = new ColoredPoint(3, 3, Color.RED);
p[3] = new Point(4, 4);
for (int i = 0; i < p.length; i++)
{ String s = p[i].toString();
System.out.println("p[" + i + "] : " + s); }
return;
}
}
This code is an example of ____.
a) overloading
b) callback
c) early binding
d) polymorphism
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
