M2: Getting Started with Scanner Diagram | Quizlet

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/9

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No study sessions yet.

10 Terms

1
New cards

A class for reading data from a user, String or file.

Scanner

2
New cards

an expression referring to input typed by a user (Standard input stream)

System.in

3
New cards

create a new instance (object) of the Scanner class to read input typed by a user.

new Scanner( System.in)

4
New cards

declaring a variable to hold the reference to an instance (object) of Scanner

Scanner input;

5
New cards

Creates a new instance of Scanner for reading typed user input and saves the reference in a variable named input (this doesn't actually read input but simply prepares to read input)

Scanner input = new Scanner(System.in);

6
New cards

calling the method nextInt() to read digits typed by the user as an int

input.nextInt()

7
New cards

declaring a variable named num to hold an int value.

int num;

8
New cards

calling a method to read an int value and then saving the value in a variable

num = input.nextInt();

9
New cards

A statement indicating that the program will use class Scanner found in the java.util package.

import java.util.Scanner;

10
New cards

call the Scanner close method when finished using the Scanner instance/object in your program

input.close();