• 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/28

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;

28 Cards in this Set

  • Front
  • Back
What is the equal comparison symbol?
==
What does == mean?
compare equal
What is the not equal comparison symbol
!=
Which has higher precedence? equality or relational operators?
relational
What happens when an int data type is compared to a double data type?
the int is converted to a double
1.2 - 1.1 == 0.1
true or false?
why?
false, round off error that can happen in double
When is it better to use .equals()?
When you want to check whether 2 objects have matching data, but == doesn't work. Strings are an example
"true" == "true"
true or false?
Error, strings cannot be compared using ==
classes like strings need to use .equals()
What method should be used if you want to compare strings and upper or lowercase doesn't matter?
equalsIgnoreCase()
What does equalsIgnoreCase() do?
compares 2 objects without paying attention to case of letters
What does the method compareTo() do?
returns an integer that’s less than 0, equal to 0, or greater than 0, depending on whether the first object is less than the 2nd, equal to the 2nd, or greater than the 2nd, respectively
What would aab.compareTo(aba) yield?
an integer less than 0 because the unicode value for the 2nda is less than the unicode value for the 2nd b
What would aba.compareTo(ab) yield?
an integer greater than zero because strings that match, but have more characters are considered greater than
What values are being compared in a compareTo() method
the unicode values of the characters of a string, including "space"
What is the logical operator for and?
&&
What is the logical operator for not?
!
What is the logical operator for or?
||
What does && mean?
and
What does || mean?
or
What does ! mean?
not
Give 2 binary logical operators?
&& and ||
What is a binary operator?
takes 2 operands
What is a Unary operator?
takes 2 operand
Give a Unary logical operator
!
What data type are the operands and results of a logical operation?
Boolean
Why is the && operation described as a short-circuit evaluation
The && operator ignores the right operand if the left operand is false
What is a benefit of short-circuit evaluations?
The && operator can check expressions that would be required to prevent an error message from being thrown
Why is the || operation described as a short-circuit evaluation?
If the left operand is true then it ignores the right operand