Trouble with arraylist and stack
Posted
by
helloman
on Stack Overflow
See other posts from Stack Overflow
or by helloman
Published on 2011-02-25T21:56:26Z
Indexed on
2011/02/25
23:25 UTC
Read the original article
Hit count: 205
I am having trouble starting out this program, I am suppose to write a program that will create an ArrayList, asking the user for 10 numbers. Then this will be put into the Array. Then after the list is made navigate it and if a number is even remove it from the ArrayList and copy it to a stack of integers.
import java.io.* ;
import java.util.*;
public class Test {
public static void main(String[] args){
Scanner input = new Scanner (System.in);
ArrayList<Integer> integers = new ArrayList<Integer>();
System.out.print ("Enter Number: \n");
for (int i = 0; i < 10; i++){
integers.add(input.nextInt());
}
for (int i = 0; i < 10 ; i++){
if (i %2==0)
}
}
}
© Stack Overflow or respective owner