Problem with finding the max element
Ok, I have a program I set up and It asks the user to enter 8 integers, it then asks for the number they want deleted, then asks for the position of the num they want deleted. Everything there works fine.
I put in a block of code to find the maximum element in the list and want it printed out after it shows them the list. Everything compiles right, but no matter what I do it always return the maximum element in the list is: 0.
I've read and reread my book and the code looks right to me, its just not grabbing number.
Here's the code in the class I have set up for determining the max element:
And here's the block of code I'm trying to get it to print out.
public void findMax(int array)
int maxElement = array;
for (int i=0; i<array.length; i++)
maxElement = array[i];
public int getMaxElement()
forgoed putting the rest of the program up because it works fine.
System.out.println("The maximum element in the list is " + intList.getMaxElement());