1/11
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
Encapsulation
Keeping data safe inside an object and controlling who can access or change it
How do you initialize an array called arr of 5 ints with default values?
int [] arr = new int [5];
Which index is the last element in an array called highTemps?
highTemps.length - 1;
When would you use an enhanced for loop instead of a traditional for loop?
If you want to access every element of an array and want to refer to elements through a variable name instead of an array index.
Primitives
Int, double, boolean, char
Can primitive values be replaced in enhanced for loops?
Cannot be replaced because an enhanced for loop makes a copy of the primitive value, so the copy is being replaced
Can ArrayLists use primitives?
No, they use objects
Wrapper classes
Integer, Double, Boolean, Character
Autoboxing
Java automatically converts primitive into object
Unboxing
Java automatically converts object into primitive
parseInt()
Converts a String into an int primitive
Declare an array
int[] nums;