Chapter 2 Flashcards
What are Literals?
It is common for programs to include constants; in Java these are referred to as literals.
Ex: 123, 123.45, ’a’, ”Gosling”
What are variables?
Variables is a named location in a computer’s memory, and the value stored in that location is controlled during the execution of programs.
What are the two data types?
Primitive data types and data types defined via classes (objects)
Ex: String and System
What are all the primitive data types?
Byte, short, int, long, float, double, char and Boolean
What are Keywords?
Java reserves the use of certain names referred to as keywords.
Ex: int
What are the Numeric Data types?
Numeric data types are used for numer values where there is no fractional component- all values are whole integers.
Ex: byte, short, int, long,
What are operators?
They are calculations or actions that use a symbol.
Ex: +, -, /, %, *
All of these operators are binary operators, meaning that they have two operands. One operand is on the left side and the other on the right.
What is arithmetic operation?
When the opera did of both are the same
Ex: int + int = int
What does a Modulo do?
Modulo gives the remainder when the first operant is divided by the second operand.
Ex: 13%5 = 3
How to use the long data type?
The value would have a suffix of L
Ex: 10025L
What are operands?
Operands are either literals, variables, or sub-expressions.
Ex: using operators, 22 + 33, (4) * (5)
What are sub-expressions?
Sub-expressions are expressions enclosed in parentheses, ( and )
What are the Operator Priories for Calculations?
Highest to Lowest
* / %
+ -
How does Operator Associativity work?
Just means the calculations read from left to right since that’s how Java reads.
What are the two types of Mixed Mode Expressions?
Widening and Narrowing