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;
41 Cards in this Set
- Front
- Back
Algorithm |
Describes how a problem is solved by listing the actions that need to be taken and the order of their executions |
|
Pseudocode |
natural language mixed with some programming code |
|
Variable |
represents a value stored in the computer's memory descriptive names to specify data types |
|
Identifiers |
names for naming elements such as variables, constants, methods, classes, packages in a program |
|
An identifier is |
a sequence of characters that consists of letters, digits, underscores (_), and dollar signs($) must start with a letter or underscore cannot start with a digit cannot be a reserved word cannot be true, false, or null can be any length |
|
specific import |
specifies a single class in the import statement import java.util.Scanner; |
|
wildcard import |
imports all the classes in a package by using the asterisk as the wildcard import java.util.*; |
|
Equals sign (=) |
used as the assignment operator |
|
Before a variable declared in a method can be used |
it must be assigned a value |
|
Named constant |
represents permanent data that never changes capitalize every letter in a constant declared by using the keyword final final double PI = 3.14159; // declare a constant |
|
4 integer types |
byte short int long |
|
Floating point types |
Float and double represent floating point numbers of two different precisions real numbers (numbers with a decimal point) |
|
operators that perform numeric operations |
+ addition - subtraction * multiplication / division % remainder |
|
Integer arithmetic yields |
an integer result |
|
numeric operators |
applied the same way as in an arithmetic expression |
|
augmented assignment operators |
+= addition assignment -= subtraction assignment *= multiplication assignment /= division assignment %= remainder assignment |
|
increment operator |
++ |
|
decrement operator |
-- |
|
When evaluating an expression with values of mixed types, |
java automatically converts operands to appropriate types |
|
(type)value notiation |
you can explicitly convert a value from one type to another |
|
Widening a type |
casting a variable of a type with a small range to a variable of a type with a larger range can be performed automatically without explicit casting System.out.println((double)1 / 2); //displays 0.5 because 1 is cast to 1.0 first and then divided by 2 |
|
Narrowing a type |
casting a variable of a type with a large range to a variable of a type with a smaller range must be performed explicitly System.out.println((int)1.7); //displays 1, when a double value is cast into an int value, the fractional part is truncated |
|
String concatenation operator |
+ combines two strings into one |
|
Create a scanner |
creates an object of the scanner type whole line: Scanner input = new Scanner(System.in) |
|
Import class |
import java.util.Scanner Scanner is in the java.util package |
|
read a double |
//Prompt the user to enter a radius System.out.print("Enter a number for radius: "); double radius = input.nextDouble(); |
|
Prompt |
directs user to enter an input |
|
Print vs println |
println moves to the beginning of the next line after displaying the string, but print does not advance to the next line when completed |
|
Variabel declaration |
tells the compiler to allocate appropriate memory space for the variable based on its data type |
|
Assignment statement |
designates a value for a variable |
|
byte range and storage size |
-2^7 to 2^7 - 1(-128 to 127) 8-bit signed |
|
short range and storage size |
-2^15 to 2^15 - 1(-32768 to 32767) 16-bit signed |
|
int range and storage size |
-2^31 to 2^31 - 1(-2147483648 to 2147483647)
32-bit signed |
|
long range and storage size |
-2^63 to 2^63 - 1 64-bit signed |
|
float range and storage size |
Neg range: -3.4028235E + 38 to -1.4E - 45 Pos range: 1.4E - 45 to 3.4028235E + 38 32-bit IEEE 754 |
|
double range and storage size |
Neg range: -1.79.....E + 308 to -4.9E - 324 Pos range: 4.9E - 324 to 1.79.....E + 308 64-bit IEEE 754 |
|
Math.pow(a, b) method |
can be used to compute a^b Systme.out.println(Math.pow(a, b)); //Displays value of a^b |
|
Operator precedence rule |
multiplication, division and remainder operators are applied first if an expression contains several multiplication, division, and remainder operators, it is left to right addition and subtraction operators are applied last if contains several, left to right |
|
augmented assignment operator examples |
i += 8 ... i = i + 8 i -= 8 ... i = i - 8 i *= 8 ... i = i * 8 i /= 8 ... i = i / 8 i %= 8 ... i = i % 8 |
|
overflow |
when a variable is assigned a value that is too large (in size) to be stored |
|
underflow |
when a floating point number is too small (too close to zero) to be stored |