Computer Science Array List
The card class implements a playing card. Create an ArrayList named hand and instantiate five cards in your hand.
ArrayList <card> hand = new ArrayList<card>(); for(int i = 0; i<5; i++) hand.add(new card);
Create an ArrayList named squares and add 3 squares (there is only one variable and it is an int)
ArrayList <int> squares = new ArrayList<int>(); for(int i = 0; i < 3; i++) squares.add();
Define an arraylist
a class that manages a sequence of objects, just like an array does, but it can grow and shrink and supplies methods
determine the length of an array list named cards
cards.size();
Use a for loop to print out the information in the hand Array List
for(int i = 0; i < hand.size(); i++) syso(hand.get(i));
add Joe to an array list named names
names.add("Joe");
does .substring include the last parameter
no
get the 3rd item in an ArrayList named squares
squares.get(3);
What is the size of an array list when it is first constructed
0
