chap 1 -revisited Flashcards

re=written cards

1
Q

compile time error?

A

code errors found in compiler

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

logic error?

A

code does not execute as intended but it does pass the compiler

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

run time error?

A

code passes the compiler but the program terminates itself abnormally.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

debugging?

A

code is checked for logic errors and fixed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

/* */ –> what does this do?

A

all the comments written between the slashes and asterics is commented out and does not get executed in the code. /* comments here */

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

/** */ does what?

A

sends documentation to an external file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

main method

what is it?

A

main method: processing of code begins here but the main method also needs to be preceeded by public, void or static.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

what does the word: void , public or static

mean before main method?

A

void: means there is no output.
public: means that any program or class can have access to the code in the main method.
- static: means that the data does not change.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

what are Identifiers?

A

Identifiers: words used when writing programs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

to concatenate?

A

concatenate: used to connect two strings together. The plus + sign is used.
–used when a string statement takes up two lines of code within the program.
“code is written here but”
+ “ ran out of room so we concatenated them using + “

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

concatenate a string to numbers how?

A

just use the + symbol as long as one side is a string then both become a string.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

how to not accidentally use concatenation when trying to add two numbers together?

A

make sure you put the arithmetic within a set of parentheses with a concatenation infront and outside of the () .

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

escape sequences are?

A

\ keys allow special characters to be used within the code instead of being seen by the java editor as an action like the end of a string. for instance
" will show a quotation mark but had the “ been used without the slash then the compiler would think it is the start of a string.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

what are some escape sequences?

A
\n new line
\t tab in
\r carriage return
\\ shows a backslash
\" shows a quotation mark
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Variable?

where is it listed usually? what do we call it when we list it?

A

declare a variable means to just enter the variable name and end it with a ; at the end.
–a variable is a word that is chosen by the programmer to then be called on later in the code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

initialization?

example?

A

initialization is when a variable is given a value for the first time.
String variableName = (“my name”);

17
Q

can variables be listed off one after the other if they are the same type such as int or String? if so how?

A

by using commas.

String variableName, nameTwo, nameThree = (“”);

18
Q

can variables change values?

A

yes, variables can change values throughout the code as long as it is not marked as a constant, then all caps are used and it is never changed.

19
Q

what is a constant?

give an example using the integer of 5 as the cost.

A

a variable that is preceeded with the word final and then the value never changes.
example:
fianl int cost = 5;

20
Q

primitive data types and what are some?

A

the amount of ram space is calculated based on the data type chosen. data types have certain things they can represent.
int = positive numbers
String = a list of printable words or numbers within “”
float = decimal point numbers
Boolean = uses true or false only.

21
Q

what does the arithmetic operators do?
%
division symbol /

A

% = will divide a number and only return the remainder as a whole number unless the variable is preceded with float or double.
/ division symbol = division but discards remainders unless a decimal or float is used.

22
Q

incremental counting is what and how does it work?

or incremental subtraction?

A
the addition of one each time the variable is called on. often used in do while loops. 
written as:
variableName++ 
which means variableName + 1;
works with subtraction too.
23
Q

what are some assignment operators?

A
!      means not
!=     means not equal
==     means equal
&&  logical AND
||     logical OR
24
Q

what is a widening or narrowing conversion and how does it work?

A

example: float VariableName = int VariableTwo

The decimal value is narrowed (converted) to an integer so the decimal portion is cut off.

25
Q

how is the scanner class used?

A
1st import the class:     import java.util.scanner;
scanner (variableNameScan) = new object(input source)
scanner scan = new scanner(System.in);
26
Q

what is the scanner class?

A

used to scan or intake input from the user and assign it to a variable.

27
Q

what are some scanner methods?

A

Scanner variable will be the following word for this example: scan

scan. next scans in the next information
scan. nextLine scans in the next line
scan. nextInt scans in the next number
scan. nextDouble scans in a decimal
scan. Echo scans in and repeats info to the screen.