Unknown Vocab Lessons #1-14 Flashcards
indices
plural form of index, referring to the numbers that begin to be counted up from zero, like those used with substring
what are the two methods that will turn everything lower/upper case?
toUpperCase() and toLowerCase()
in increment, what is the difference between x++ and ++X
x++ increments x AFTER the whole statement has been read whereas ++x increments it immediately. The same applies for decrement (x–, –x)
truncation
when the program throws away the fractional part of an integer division, so 7/2 is not 3.5, it is 3. It always rounds down.
what does Math.ceil(double x); do?
rounds up to the nearest whole number (so if x = 57.2, then Math.ceil(x) = 58.0
what does Math.floor(double x) do?
rounds down to the nearest whole number so if
x = 57.2 then Math.ceil(x) = 57.0
what does Math.pow(double b, double e); do?
does b to the power of e
what does Math.random() do for doubles?
returns a random value in the range of 0
what does Math.round(double x) do?
rounds to the NEAREST whole number (does not simply round down).
how else can you assign a value to a boolean besides saying boolean x = true/false; ?
You can set the boolean equal to a operation that will either be true or false
ex: boolean dave = true; //OR
boolean dave = 3>2; //true
how can you compare two Strings without caring about upper or lower case??
String y = “fUnKyTOWN”;
if(y.equalsIgnoreCase(“funkytown”){
…………………………….
}
what does continue; do?
all code after the continue statement is skipped for that particular iteration in the loop, though the increments still continue as normal
is it legal to convert a String to a char?
Not without using a method besides pure assignment (‘A’ is illegal but “A” is legal)
what kinds of quotes do chars use?
‘single quotes’ not “double”
Is it legal to store type char in an int? If so, why?
Is it legal to store type int in char?
Yes, because the char letters will be read as ASCII hexadecimal letters. It is illegal to store ints in chars (but you can cast to char)