Question: Can you help add a driver class or method that can fix the issue and after you fix it can you explain to me what
Can you help add a driver class or method that can fix the issue and after you fix it can you explain to me what is going on with this program?
import java.util.*;
public class ArrayDemoObj{ public static void main (String arg [ ] )throws Exception{ PositiveNumber myArray[ ]= new PositiveNumber[5]; int num = 88; Scanner sc = new Scanner(System.in); for (int i=0; i< myArray.length; i++){ System.out.println(myArray[i]); } System.out.println("**************"); System.out.println("The array length is: "+ myArray.length); sc = new Scanner(System.in); sc.nextLine( ); PositiveNumber pn = new PositiveNumber(num); Arrays.fill(myArray, pn); for (int i=0; i< myArray.length; i++){ System.out.println(myArray[i]); } pn.setNum(45); for (int i=0; i< myArray.length; i++){ System.out.println(myArray[i]); } } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
