2.7 APCSA Vocab: Scanner Class

studied byStudied by 10 people
5.0(1)
learn
LearnA personalized and smart learning plan
exam
Practice TestTake a test on your terms and definitions
spaced repetition
Spaced RepetitionScientifically backed study method
heart puzzle
Matching GameHow quick can you match all your cards?
flashcards
FlashcardsStudy terms and definitions

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 8 people
340 days ago
5.0(1)
note Note
studied byStudied by 64 people
145 days ago
5.0(1)
note Note
studied byStudied by 230 people
849 days ago
5.0(1)
note Note
studied byStudied by 6 people
711 days ago
5.0(1)
note Note
studied byStudied by 5 people
98 days ago
5.0(1)
note Note
studied byStudied by 92 people
91 days ago
5.0(3)
note Note
studied byStudied by 18 people
830 days ago
5.0(1)
note Note
studied byStudied by 8907 people
656 days ago
4.8(41)

Explore top flashcards

flashcards Flashcard (52)
studied byStudied by 3 people
616 days ago
5.0(1)
flashcards Flashcard (49)
studied byStudied by 3 people
737 days ago
5.0(1)
flashcards Flashcard (47)
studied byStudied by 106 people
483 days ago
5.0(1)
flashcards Flashcard (160)
studied byStudied by 1 person
614 days ago
5.0(1)
flashcards Flashcard (75)
studied byStudied by 14 people
765 days ago
5.0(1)
flashcards Flashcard (25)
studied byStudied by 3 people
435 days ago
5.0(1)
flashcards Flashcard (45)
studied byStudied by 14 people
588 days ago
5.0(1)
robot