CODE
import TerminalIO.KeyboardReader;
public class ArrayListNumPV
{
public static void main (String[] args)
{
//ArrayList containing 0 1 2 3 4 5 6 7 8 9 10
ArrayList<Integer> list = new ArrayList<Integer>();
int length = 11;
for(int k =1; k<length; k++)
{
total+=k;
total++;
}
for(Integer total : list)
{
System.out.println(total);
}
int average = (total/length);
System.out.println(average);
list = list.remove(3);
list = list.remove(4);
list.add(20,25);
}
}
Hello, i am trying to create ArrayList of 10 numbers, use a for loop. Print total , print average, add 20,25, print ArrayList (is that the for(Integer total : list)?) and remove the 3rd and 4th numbers in the list..
Its first ArrayList program for me and i am struggling, I think i have the basics down but.. ALSO ---public static void main (String[] args) i know there arent supposed to be any parameters but i dont know what to put instead. sigh thank you for the help.