what is my console giving me trouble in main, keeps giving me an nullexception error in my void on the for loop. why is it going null??? can it be because in my argument myArray is not going to createIntegers? i cant display my array in main
public class DimentionalArray {
int[] createIntegers(int size_of_array)
{
//******* FILL IN CODE *********
// Your code will create an array of ints as large as specified in size_of_array
// Fill the array in with the values: 0, 100, 200, 300, ....
// Return the array that you just created
int[] numarray = new int[size_of_array];
int mutilply = 100;
for(int i =0; i<size_of_array; i++)
{
System.out.println(numarray[i]);
}
return numarray;
}
void printArray(int[] myArray)
{
//******* FILL IN CODE *********
// Print out your array with one number per line. Get the size of the
// array from the "myArray" parameter (no hard coding the size)
for(int i = 0; i<myArray.length; i++) // NULL EXCEPTION ON THIS LINE WHY??
{
System.out.println(myArray[i]);
}
}
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
System.out.println("Enter size of array to create: ");
int num = keyboard.nextInt();
//******* FILL IN CODE *********
// Construct an instance of the OneDimensionalArrays class
// Using this object instance, call createIntegers to create
// an array of integers. Don't forget to save the results
// Then call the printArray method to print out the contents
// of your array.
DimentionalArray output = new DimentionalArray();
output.createIntegers(num);
output.printArray(myArray);
}