2.4. Assessment: Construct A ScannerΒΆ
Subgoals for using objects (creating instances)
Declare variable of appropriate class datatype.
Assign to variable: keyword new, followed by class name, followed by ().
Determine whether parameter(s) are appropriate (API)
Number of parameters
Data types of the parameters
- Scanner
- input
- new
- System.in
- Scanner
- input
- new
- System.in
- Scanner
- input
- new
- System.in
- Scanner
- input
- new
- System.in
- Scanner
- input
- new
- System.in
Q1: Fill in the blanks for the following code, if the purpose of the code is to create a new Scanner instance called input
.
___A___ ___B___ = ___C___ ___D___(___E___);
Fill in blank A.
Q2: Fill in the blanks for the following code, if the purpose of the code is to create a new Scanner instance called input
.
___A___ ___B___ = ___C___ ___D___(___E___);
Fill in blank B.
Q3: Fill in the blanks for the following code, if the purpose of the code is to create a new Scanner instance called input
.
___A___ ___B___ = ___C___ ___D___(___E___);
Fill in blank C.
Q4: Fill in the blanks for the following code, if the purpose of the code is to create a new Scanner instance called input
.
___A___ ___B___ = ___C___ ___D___(___E___);
Fill in blank D.
Q5: Fill in the blanks for the following code, if the purpose of the code is to create a new Scanner instance called input
.
___A___ ___B___ = ___C___ ___D___(___E___);
Fill in blank E.