Welcome to the Ranch
Are you supposed to remove prime numbers from a List? That is exactly what you aren't doing. You are creating a second List, and the original List remains unchanged. Norm has suggested one way to get the new List outside your method, but you can actually remove primes from the original List, without using a second List. Please go through the methods of
List (including those shown as “declared in Collection”).
As Norm has told you, if you reassign the local variable, that assignment only applies in local scope. If you reassign the variable at a disatance, you are not modiying the object, but replacing it by an object reference incorporating the desired changes.
Why have you go so much code in the
main() method? That isn't what it is designed for. Get all the “real” code out into objects and you won't be tempted to use the keyword
static. You don't need to iterate every number > 2 to verify that a number is prime.