Java Program

500 pts pending

Create a class called Alp that

a) a constructor that takes an integer and stores it as a private variable

b) has a single method called printInt() that prints out the integer

In your main function, create an ArrayList that holds Alp objects. In a for loop add 10 Alp objects to the ArrayList, calling the constructor for each with the index of the array, i.e., the first Alp object would have 0 as its integer.

Write a second loop that prints the contents of the array list.

Answers (1)


    View this solution... try Chegg Study


    Upgrade now