• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/36

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

36 Cards in this Set

  • Front
  • Back
What number does Java start counting String and Array indexes with?
0
What is the difference between "Hello" and new String("Hello")?
Using a string literal adds the string to the string pool. Using the new keyword creates an object that goes on the heap.
What happens if a string and a number are added together?
The number will be converted into a string and the two strings will be concatenated
What does it mean for an object to be immutable?
Once the object is created it cannot be altered directly.
True or False: A constructed string and a string in the string pool with the same characters in sequence will return equal when compared with ==
FALSE. They are different strings in the pool and == checks reference equality
True or False: A constructed string and a string in the string pool with the same characters in sequence will return equal when compared with the equals() method
TRUE. String implements the equals method and uses it to compare the actual contents of a string.
If strings are immutable, how do you change the value of a string variable?
Assign the results of a string modifying method to the variable.
What does String.length() do?
Returns the number of characters in the string as an int
What does String.charAt() do?
Returns the character at the specified index
If indexOf doesn't find any characters in the string that match the provided parameter, what value is returned?
-1
True or False: The character at the index specified by the first parameter of a substring is included in the results
TRUE
True or False: The character at the index specified by the second parameter of substring is included in the results
FALSE, it stops before the character at the end index
True or False: The end index parameter in a substring can be one greater than the actual max index
TRUE
If an ending index is not provided, what will substring return?
A string starting with the provided start index to the end of the string
What is the difference between the String and StringBuilder classes?
String is immutable, while StringBuilder is not
If a class hasn't implemented equals(), how does the method work?
Uses the default == operator, which checks for reference equality
What value will a binarySearch on an unsorted array return?
The value is unpredictable and not useful
What value will a binarySearch on a sorted array return if the target element is in the array?
The index of the match
What value will a binarySearch on a sorted array return if the target element is NOT in the array?
The negative value where the target element would be minus 1
True or False: An array can change size after it is instantiated.
FALSE. An array's size is fixed once it is instantiated. An ArrayList however dynamically changes size as items are added.
How do you create an ArrayList with a specified type?
Using generics, which is declared with the diamond: operator <>
How do you convert an ArrayList to an Array?
toArray()
How do you convert an Array to an ArrayList?
Arrays.asLIst(arrayParameter)
What is Autoboxing?
Autoboxing is when Java automatically converts a primitive into the relevant wrapper class so it can be used by processes that require an object over a primitive
What is a Wrapper Class?
A Wrapper Class is a class that is the object form of a primitive data type
When used on a string, what is the difference between parse and valueOf?
Parse will convert the string into a primitive data type, while valueOf will convert the string into a wrapper class object
How do you sort an Array?
Arrays.sort()
How do you sort an ArrayList?
Collections.sort()
How do you create a date/time object with the new LocalDate/Time classes?
Use the static method of()
True or False: The month index begins at 1 instead of 0.
TRUE
True or False: You can still create a date object with LocalDate/Time with the new keyword
FALSE, all constructors are private and can only be accessed through the of() static method
True or False: The LocalDate/Time classes are immutable
TRUE, results of any methods which modify a date/time object must have their results assigned to a variable
True or False: Period class instantiators cannot be chained because the methods are static.
TRUE
What are the 5 ways a Period object can be instantiated?
ofYears, ofMonths, ofWeeks, ofDays, and of(Years, Months, Days)
What is the Time equivalent of a Period?
Duration
True or False: You cannot apply a date modifier to a time only object.
TRUE