Chapter 2 - revisited Flashcards Preview

Java 1 > Chapter 2 - revisited > Flashcards

Flashcards in Chapter 2 - revisited Deck (6)
Loading flashcards...

when using the scanner class - how do you scan in more than one number in a row? how are the prompt(s) used with the ?

only one string statement is needed before implementing several scanner objects. you do not need to repeat the string statement.
System.out.println(" please enter the two numbers")
num1 = scan.nextInt()
num2 = scan.nextInt()


what is the statement used to invoke the scanning method and giving it a variable name?

scanner scan = new scanner (;
^class ^variable name for the scanning method.
when using the scan method we concadinate the variable name we chose with the type of data coming in.
number1= scan.nextInt();


what is a numeric literal?

numeric literal is a number


what are variables?

variables: words that hold values and can change in value.


how are character variables instantiated? what is the format?

char letterChosen = 'A';
^type ^variable name ^ the single ' is used for characters whereas a double " is used for strings.


is it possible to assign a boolean to variable words and if so how?

boolean yes = true;
boolean no = false;
now the words yes and no represent true and false and can be written into code.