The following example code demonstrates How to Create ArrayList of Numeric Types in Java.

Here is a Java program that implements the given requirement.

import java.util.ArrayList;
import java.util.Iterator;

public class Main {
  public static void main(String[] args) {
    ArrayList<Number> list = new ArrayList<>();
    list.add((byte) 50);

    Iterator<Number> iterator = list.iterator();
    while (iterator.hasNext()) {

This program creates an ArrayList of type Number called list, adds 5 elements of different numeric types (int, float, double, long, and byte) to it, and then creates an iterator iterator using the iterator() method of the ArrayList. The elements of the list are displayed using a while loop, in which the iterator.hasNext() method returns true until there are no more elements in the list, and the method returns the next element in the list. Note that the ArrayList only contains elements of numeric types, as specified in the requirement.

Further Reading

Understanding Enterprise Java Beans

Java Practice Exercise