2.7 APCSA Vocab: Scanner Class

studied byStudied by 8 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 132 people
... ago
5.0(1)
note Note
studied byStudied by 55 people
... ago
4.5(2)
note Note
studied byStudied by 7 people
... ago
5.0(1)
note Note
studied byStudied by 30 people
... ago
5.0(1)
note Note
studied byStudied by 37 people
... ago
5.0(1)
note Note
studied byStudied by 6 people
... ago
5.0(1)
note Note
studied byStudied by 16 people
... ago
5.0(1)
note Note
studied byStudied by 23129 people
... ago
4.8(187)

Explore top flashcards

flashcards Flashcard (21)
studied byStudied by 4 people
... ago
5.0(1)
flashcards Flashcard (93)
studied byStudied by 13 people
... ago
5.0(2)
flashcards Flashcard (27)
studied byStudied by 5 people
... ago
5.0(1)
flashcards Flashcard (58)
studied byStudied by 4 people
... ago
5.0(1)
flashcards Flashcard (83)
studied byStudied by 8 people
... ago
5.0(1)
flashcards Flashcard (30)
studied byStudied by 1 person
... ago
5.0(1)
flashcards Flashcard (22)
studied byStudied by 2 people
... ago
5.0(1)
flashcards Flashcard (68)
studied byStudied by 29 people
... ago
5.0(2)
robot