Java
Copy the following code to a java file and explain in the comment what is the output and why.
1- ArrayList list = new ArrayList();
for (int i = 1; i <= 10;="" i++)="">=>
list.add(10 * i);
}
for (int i = 0; i < list.size();="" i++)="">
list.remove(i);
System.out.println(list); // what is the expected output?
2- ArrayList list = new ArrayList();
int size = list.size();
for (int i = 0; i < size;="" i++)="">
list.add(i, 42);
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here