Section 1

Preview this deck

exception

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 1, 2020

Cards (62)

Section 1

(50 cards)

exception

Front

a detected runtime error that commonly prints an error message and terminates the program.

Back

A programmer compares strings relationally

Front

notation str1.compareTo(str2). compareTo() returns values as follows. str1 less-than str2 — Negative number — str1.compareTo(str2) < 0

Back

how to make a random number

Front

uses randGen.nextInt(6) to get a new random number between 0 and 5

Back

floating-point literal

Front

a number with a fractional part, even if that fraction is 0, as in 1.0, 0.0, or 99.573. Good practice is to always have a digit before the decimal point, as in 0.5.

Back

index

Front

string character has a position number — he numbering starts with 0, not 1. charAt(): The notation someString.charAt(0)

Back

What is bigger 'A' or 'a'?

Front

'A' is 65, B' is 66, etc., while 'a' is 97, 'b' is 98, etc.

Back

someString.charAt(0)

Front

determines the character at index 0

Back

logic error

Front

while a program runs, also called a runtime error or bug

Back

Scanner

Front

first creating a Scanner object via the statement Scanner scnr = new Scanner(System.in) — System.in corresponds to keyboard input — read using hourlyWage = scnr.nextInt()

Back

memory

Front

a circuit that can store 0s and 1s in each of a series of thousands of addressed locations

Back

final variable

Front

A constant — ex/ final double SPEED_OF_SOUND = 761.207;

Back

length()

Front

number of character

Back

isEmpty()

Front

true if length is 0

Back

bytecode / virtual machine

Front

allows the same executable to run on different processor types so portable

Back

concat(moreString)

Front

Creates a new String that appends the String moreString at the end.

Back

For an arithmetic operator like + or *, if either operand is a double

Front

the other is automatically converted to double, and then a floating-point operation is performed.

Back

System.out.print vs System.out.println

Front

(note the ln at the end, short for "line"), starts a new line after the printed output. *(Text in double quotes " " is known as a string literal)

Back

floating-point types should not be compared using the...

Front

equality operators, due to the imprecise representation of floating-point numbers

Back

compiler

Front

tool that converts a program into low-level machine instructions (0s and 1s)

Back

Import statement.

Front

import packageName.ClassName;

Back

syntax error

Front

violate a programming language's rules on how symbols can be combined to create a program. Ex: forgot a ;

Back

statement

Front

is a program instruction. Each statement usually appears on its own line. Each program statement ends with a semicolon ";", like each English sentence ends with a period.

Back

A programmer can compare two strings using

Front

str1.equals(str2). The equals method returns true if the two strings are equal

Back

declare a boolean—write code

Front

boolean isNeg = false;

Back

How to solve problems

Front

I SEE — Identify - Set Up - Execute - Evaluate

Back

indexOf(item)

Front

Index of first item occurrence, else -1. (finds the #occurance of item. lastIndexOf(item) finds the last occurrence .

Back

Definding a string

Front

String wordRelative = ""; — note the capital S

Back

bitwise

Front

logical AND is && and not just &, and likewise that logical OR is || and not just | — When both operands are integers, the bitwise operators evaluate to an integer value

Back

compile-time error

Front

syntax error is detected by the compiler

Back

Not finding an error at the specified line...

Front

the programmer should look to previous lines. Ex/ ; error but actually a () error

Back

branching

Front

execute either one statement group or another, depending on an expression's value. An example is to print "Too young to drive" if userAge < 16, else print "OK to drive"

Back

memory

Front

is composed of numerous individual locations, each able to store a value. The statement (veriable) int wage = 20 reserves a location in memory

Back

Oerflow

Front

when the value being assigned to a variable is greater than the maximum value the variable can store. Overflow with floating-point results in infinity.

Back

System.out.println("Wage is: " + wage) output

Front

Wage is: 20

Back

programs called assemblers

Front

translate human readable instructions, such as "Mul 97, #9, 98", known as assembly language instructions, into machine instructions

Back

substring(startIndex, endIndex)

Front

Returns substring starting at startIndex and ending at endIndex - 1. length is endIndex-startIndex

Back

circuits called processors

Front

to process (aka execute) a list of desired calculations, each calculation called instruction

Back

isNeg = (userNum < 0);

Front

Alternative way to set a Boolean variable

Back

To print multiple character variables

Front

input should start with "" + and each character variable should be separated by a +

Back

import java.util.Scanner;

Front

Enabling reading of input.

Back

Assignment statement

Front

variableName = expression;

Back

can compare strings while ignoring case using

Front

str1.equalsIgnoreCase(str2) and str1.compareToIgnoreCase(str2)

Back

System.out.println(songNum " songs"); — what is the error

Front

"+"

Back

1 / 2 is what—(5 + 10 + 15) * (1 / 3) is what

Front

Zero 0

Back

scnr.next() versus scnr.nextInt()

Front

The first one gets a string while the other gets a nu mber — scnr.nextLine() read all until ENTER key

Back

dimentially consistence

Front

allways check dimentions

Back

method

Front

a list of statements that can be executed by referring to the method's name — Invoking a method is a method call

Back

6.02e+23 is what

Front

represent 6.02x1023

Back

pseudo-random number generator

Front

produces a specific sequence of numbers based on a seed number

Back

warning like "Warning, dividing by 0 is not defined"

Front

doesn't stop the compiler from creating an executable program, but indicates a possible logic error.

Back

Section 2

(12 cards)

isDigit(c)

Front

true if digit: 0-9.

Back

Strings are considered immutable

Front

String userText initialized to "climb". The method call userText.concat("ing") create new String "climbing" — to change use userText = userText.concat("ing")

Back

str1 + str2

Front

Returns a new String having str1 with str2 appended. str1 may be a String variable or string literal. Likewise for str2. One of str1 or str2 (not both) may be a character.

Back

isLetter(c)

Front

true if alphabetic: a-z or A-Z

Back

isWhitespace(c)

Front

true if whitespace.

Back

toUpperCase©

Front

Uppercase version

Back

enumeration type

Front

defines a name for a new type and possible values for that type. — public enum identifier {enumerator1, enumerator2, ...} — like biuld in types int, chat, etc. — outside main method

Back

replace(findStr, replaceStr) / replace(findChar, replaceChar)

Front

Returns a new String in which all occurrences of findStr (or findChar) have been replaced with replaceStr (or replaceChar).

Back

conditional expression — shorthand of if-else

Front

y = condition ? exprWhenTrue : exprWhenFalse

Back

If (x - y) < 0.0001, x and y are deemed equal

Front

Floating-point numbers should be compared for "close enough" rather than exact equality

Back

str1 += str2

Front

Shorthand for str1 = str1 + str2. str1 must be a String variable, and str2 may be a String variable, a string literal, or a character.

Back

toLowerCase(c)

Front

Lowercase version

Back