This is regarding a Java homework assignment: I want to create a method that takes the list of cards as a parameter and prints all the cards to the screen. Each card should print all stored information so that I can use the newly created method to print all the cards. And it is required for me to use the Array list of Card objects as a parameter.
I have three class in this program, namely - Main.java, HandDrawn.Java, and Card.java. Basically the program tracks the Christmas card information with the sender's name and if they are hand written or not. I'm stuck at this point as I don't know how to use ArrayLists properly and pass them through a method in order to print them.
public class Main {
public ArrayList<Card> cardsList = new ArrayList<>();
public static void main (String [] args){
Main myApp = new Main();
}
public void printAll (ArrayList<Card> cardArrayList){
System.out.println(cardArrayList);
HandDrawn sender1 = new HandDrawn("Anna", true);
HandDrawn sender2 = new HandDrawn("Kalle", false);
cardsList.add(0, sender1);
cardsList.add(1, sender2);
}
public void printing(ArrayList<Card> cardsList) {
System.out.println(cardsList);
}
}