Consider the following program:
import java.math.BigDecimal; public class Main { public static void main(String []args) { Number [] numbers = new Number[4]; numbers[0] = new Number(0); // NUM numbers[1] = new Integer(1); numbers[2] = new Float(2.0f); numbers[3] = new BigDecimal(3.0); // BIG for(Number num : numbers) { System.out.print(num + " "); }//from www.j a v a 2 s. c om } }
Which one of the following options correctly describes the behavior of this program?
a)
Number is an abstract class, hence you cannot instantiate it using new operator.
Many classes including Integer, Float, and BigDecimal derive from the Number class.