IT102 JAVA SCANNER Flashcards

1
Q

When coding you often need to get information from the user. In Java you can use ______ ____to do this.

A

Scanner Class

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

Java Scanner helps you to read different types of ____like____,____,____

A

data , numbers(int, double), text(string), and true/false values(boolean)

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

The Scanner class is part of the _____.

A

java.util package.

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

The Scanner takes the user’s input and splits it into smaller parts, called _____. It usually uses whitespaces to separate these parts.

A

tokens

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

The Scanner takes the user’s input and splits it into smaller parts, called tokens. It usually uses _____ to separate these parts.

A

whitespaces

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

System: This is the ___ __ ____ in Java
Scanner: This is the name of the class
scannerName : This is the name you give to your Scanner object. You can choose any name, like input, scanner, or reader.

A

built in class

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

____: This is the built in class in Java
Scanner: This is the name of the class
scannerName : This is the name you give to your Scanner object. You can choose any name, like input, scanner, or reader.

A

System

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

System: This is the built in class in Java
____: This is the name of the class
scannerName : This is the name you give to your Scanner object. You can choose any name, like input, scanner, or reader.

A

Scanner

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

System: This is the built in class in Java
Scanner: This is the___ __ ___
scannerName : This is the name you give to your Scanner object. You can choose any name, like input, scanner, or reader.

A

name of the class

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

System: This is the built in class in Java
Scanner: This is the name of the class
____- : This is the name you give to your Scanner object. You can choose any name, like input, scanner, or reader.

A

scannerName

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

System: This is the built in class in Java
Scanner: This is the name of the class
scannerName : This is the ____ you give to your Scanner object. You can choose any name, like input, scanner, or reader.

A

name

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

_____: This creates the Scanner object and tells it where to get its input
System.in: for reading input for the keyboard
A file object: reading data from a file
A string or input stream: means the Scanner can also read data from string or other sources like network data.

A

New Scanner(inputSource)

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

New Scanner(inputSource): This creates the ___ ___and tells it where to get its input
System.in: for reading input for the keyboard
A file object: reading data from a file
A string or input stream: means the Scanner can also read data from string or other sources like network data.

A

Scanner object

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

New Scanner(inputSource): This creates the Scanner object and tells it where to get its input
____: for reading input for the keyboard
A file object: reading data from a file
A string or input stream: means the Scanner can also read data from string or other sources like network data.

A

System.in

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

New Scanner(inputSource): This creates the Scanner object and tells it where to get its input
System.in: for _____ for the ___
A file object: reading data from a file
A string or input stream: means the Scanner can also read data from string or other sources like network data.

A

reading input—keyboard

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

New Scanner(inputSource): This creates the Scanner object and tells it where to get its input
System.in: for reading input for the keyboard
_ ___ ___: reading data from a file
A string or input stream: means the Scanner can also read data from string or other sources like network data.

A

A file object

17
Q

New Scanner(inputSource): This creates the Scanner object and tells it where to get its input
System.in: for reading input for the keyboard
A file object: ____-
A string or input stream: means the Scanner can also read data from string or other sources like network data.

A

reading data from a file

18
Q

New Scanner(inputSource): This creates the Scanner object and tells it where to get its input
System.in: for reading input for the keyboard
A file object: reading data from a file
___ ___ ___: means the Scanner can also read data from string or other sources like network data.

A

A string or input stream

19
Q

Scanner class in java helps you read different kinds of input,making it easier for the users to work with your program. It has various ____, each designed for a specific type of data. Learning these methods will help you use the Scanner class effectively.

20
Q

Scanner class in java helps you read different kinds of input,making it easier for the users to work with your program. It has various methods, each designed for a ____ ___ ___-. Learning these methods will help you use the Scanner class effectively.

A

specific type of data

21
Q

Scanner class in java helps you read different kinds of input,making it easier for the users to work with your program. It has various methods, each designed for a specific type of data. Learning these methods will help you use the ___ ___ ___.

A

Scanner class effectively

22
Q

If the user enters the wrong type of data - like typing letters when the program expects a number - they will see an error called ____ ____

A

InputMismatchException
METHODS

23
Q

The scanner class in java reads a whole line of input and breaks it into smaller parts called “——–” it uses a delimiter to separate these tokens a delimiter is just a character or group of characters that acts as a “seperator”

24
Q

The scanner class in java reads a whole line of input and breaks it into smaller parts called “tokens” it uses a ——- to separate these tokens a —– is just a character or group of characters that acts as a “seperator”

25
The scanner class in java reads a whole line of input and breaks it into smaller parts called “tokens” it uses a delimiter to separate these tokens a delimiter is just a character or group of characters that acts as a “--------”
seperator
26
nextInt()for ------. nextDouble() for ------ -----. nextLine() for ---- ---- -----
integers decimal numbers whole lines of text
27
------for integers. ------ for decimal numbers. ------- for whole lines of text
nextInt() nextDouble() nextLine()
28
------: after reading the input, you can use it in your program this might involve calculation checking if the input correct or other tasks
Process Input
29
-------: Once you're done reading input, it's important to close the Scanner using the close() method. This helps free up the system resources and prevents issues later on.
Close the Scanner
30
Close the Scanner: Once you're done reading input, it's important to close the Scanner using the ------. This helps free up the system resources and prevents issues later on.
close() method
31
In java, particularly when using the scanner class, a “---- ------” occurs when there are residual newline characters in the input buffer that can interfere with subsequent input operations. This commonly happens when a combination of different input methods ( e.g nextTint() followed by nextline()) is used without properly handling the leftover newline character.
dangling next line
32
In java, particularly when using the scanner class, a “dangling next line” occurs when there are residual newline characters in the input buffer that can interfere with subsequent input operations. This commonly happens when a combination of different input methods ( e.g nextTint() followed by nextline()) is used without properly handling the ----- ----- -----.
leftover newline character
33
In java, particularly when using the scanner class, a “dangling next line” occurs when there are --- ---- -----in the input buffer that can interfere with subsequent input operations. This commonly happens when a combination of different input methods ( e.g nextTint() followed by nextline()) is used without properly handling the leftover newline character.
residual newline characters
34
The Input buffer is like a --- ---- -----.
waiting room data