1/18
These flashcards cover key concepts related to Arrays and ArrayLists, including methods, properties, and comparisons, to assist in understanding their use and differences.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
What method is used to add an element to a specific index in a list?
list.add(index, element);
What symbols are used in an ArrayList?
What types of data can be used in an Array?
Primitive data types (int, double, etc.) and Objects (including String)
What types of data can be used in an ArrayList?
Objects ONLY (Wrapper classes like Integer, Double, Character)
What method can be used to get the length of an ArrayList?
.size();
What property can be used to get the length of an Array?
.length
Which method is used to convert an Array to a String representation?
Arrays.toString(arrayName);
Which method is used to convert an ArrayList to a String representation?
.toString();
True or False: An Array can only be a fixed size.
True
True or False: An ArrayList can only be a fixed size.
False
True or False: An Array uses the wrapper class.
False
What collection is used when you need a fixed size, high performance data structure, especially for primitives?
Array
What collection is used when working with objects that need flexibility and dynamic resizing?
ArrayList
What is the term for looping through lists of data and performing an action with each item?
Traversing
Which loop is used to directly loop through each item in a list?
For Each Loop
What is NOT a drawback of a For Each loop?
Can’t loop through each item in a list of items.
Provide an example of a For Each loop.
for(int num : nums){ System.out.println("Number: " + num); }
What is the correct way to use the .remove() method?
schoolSupplies.remove(pencil);
What error will occur with the line 'schoolSubjects.add('Science');'?
Single quotes represent char, not String.