2.7 APCSA Vocab: Scanner Class

studied byStudied by 10 people
5.0(1)
Get a hint
Hint

nextInt()

1 / 11

flashcard set

Earn XP

Description and Tags

Existing classes and class libraries can be utilized as appropriate to create objects. One example of an existing class in Java is the Scanner class. The Scanner class is used to capture user input to use in program code. The Scanner class library is part of the java.util package and must be imported in order to be used.

12 Terms

1

nextInt()

returns the next integer

New cards
2

nextDouble()

returns the next double

New cards
3

nextBoolean()

returns the next boolean

New cards
4

next()

returns the next single string (stops at whitespace)

New cards
5

nextLine()

returns the next line as a string (stops at new line)

New cards
6

close()

void method that tells the program you are no  longer using the scanner

New cards
7

void setNums(int, int)

provide 2 integers as parameters.  The 2 numbers in Adder are set to those values.

New cards
8

void setFirst(int)

provide 1 integer as a parameter.  The first number in Adder is set to that value.

New cards
9

void setSecond(int)

provide 1 integer as a parameter.  The second number in Adder is set to that value.

New cards
10

int getSum()

The sum of the 2 numbers is calculated and returned.

New cards
11

void displaySum()

This method has no parameters and adds the two instance variables together and displays the sum.

New cards
12

Purpose of the Scanner Class

The Scanner class is used to capture user input to use in program code.

New cards

Explore top notes

note Note
studied byStudied by 4 people
... ago
5.0(1)
note Note
studied byStudied by 21 people
... ago
5.0(1)
note Note
studied byStudied by 21 people
... ago
5.0(1)
note Note
studied byStudied by 1 person
... ago
5.0(1)
note Note
studied byStudied by 6 people
... ago
5.0(1)
note Note
studied byStudied by 31 people
... ago
5.0(1)
note Note
studied byStudied by 6 people
... ago
5.0(1)
note Note
studied byStudied by 674 people
... ago
5.0(4)

Explore top flashcards

flashcards Flashcard (63)
studied byStudied by 22 people
... ago
5.0(1)
flashcards Flashcard (85)
studied byStudied by 14 people
... ago
5.0(1)
flashcards Flashcard (183)
studied byStudied by 7 people
... ago
5.0(1)
flashcards Flashcard (20)
studied byStudied by 1 person
... ago
5.0(1)
flashcards Flashcard (34)
studied byStudied by 21 people
... ago
5.0(1)
flashcards Flashcard (58)
studied byStudied by 17 people
... ago
5.0(1)
flashcards Flashcard (58)
studied byStudied by 12 people
... ago
5.0(2)
flashcards Flashcard (76)
studied byStudied by 452 people
... ago
5.0(7)
robot