Problem with ArrayList [closed]

0

The program is quite simple, x, y, z are Doubles that are constantly updated and I keep the first 2 values of each in an ArrayList and then I want to show them on the screen (I know I could have done a for but copy and paste was faster for 6 XD values)

            List<Double> list = new ArrayList<Double>();

            for(int i=0; i<5;i=+3){
                list.add(i,x);
                list.add(i+1,y);
                list.add(i+2,z);    
            }

                System.out.println(list.get(0));
                System.out.println(list.get(1));
                System.out.println(list.get(2));
                System.out.println(list.get(3));
                System.out.println(list.get(4));
                System.out.println(list.get(5));

The problem is that the program is running but it does not show the values on the screen (it does not skip any exception, it just remains blank and gives you the option to terminate the program, so I know it's running). bug in the code?

    
asked by Antonio 01.03.2018 в 09:49
source

1 answer

2

I can not understand the code very well since the explanation and the fragment of code is a bit poor and I do not know the meaning of that for but in what you have contributed I see an error in the following line:

  

for (int i = 0; i

answered by 01.03.2018 / 09:58
source