So my teacher assigned me a problem that I have to put the output of an array and pipe(not sure if that's the right word) the array values into the arraylist and then reverse the order. I know I'm very close and just missing something quite obvious. Every time I ask the teacher he just confuses me even more. Thank you for your help. I don't know what I would do without this site. My teacher said we need to have two separate classes. Purse.Java and TestPurse.Java. The array is in the TestPurse class and the arraylist is in the Purse class. Here is my testpurse.java code:
public class Purse {
// TODO Auto-generated constructor stub
/**
* @param args
*/
public static void main(String[] args) {
Purse coin = new Purse();
coin.addcoin ("Quarter");
coin.addcoin ("Dime");
coin.addcoin ("Nickel");
coin.addcoin ("Dime");
System.out.println (coin);
}
public void addcoin(String string) {
// TODO Auto-generated method stub
ArrayList<String> newpurse = new ArrayList<String>();
Collections.reverse(newpurse);
System.out.println (newpurse);
}
}