1/15
These flashcards cover key concepts from Java programming, focusing on variables, types, operations, control flow, and specific syntax used in Java.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
What does a variable in memory have, along with a type?
An identifier.
What is the eighth primitive type defined by Java, in addition to int, double, char, boolean, byte, short, and long?
float
What does declaring a variable state?
That it exists.
What is the term for assigning a variable an initial value?
Initialization
In Java, what keyword is used to declare variables that are constant and cannot be changed after initialization?
final
Which arithmetic operator, besides +, -, *, and /, is explicitly supported on primitive types in Java?
% (modulo)
What rules does Java follow when calculating expressions?
Common order-of-operation rules.
When converting data in a widening conversion, what is the characteristic of the target type's storage size compared to the original?
It has the same or more bits of storage.
When might narrowing conversions lose information regarding the storage size of the target type?
When converting to a type that has fewer bits of storage.
What property does string concatenation share with the + and - operators, in terms of how expressions are evaluated?
Precedence
What does type casting tell Java to do?
Convert one type to another.
Provide examples of type casting in Java: one for converting an int to a double, and another for truncating a double to an int.
To convert int to double: Doubleaverage=(double)12/5; To truncate a double to an int: intfeet=(int)(25.0/12.0);
What symbol represents the basic assignment operation in Java?
=
What is another looping construct in Java, besides for and while, that is part of control flow structures?
do-while
In switch statements, execution begins on the first case that matches the value of which variable?
The switch variable.
Which keyword in switch statements is used for the default case if no other cases were hit?
default