Which are true and which are false? 1. A Scanner class can be used to read in us
ID: 645503 • Letter: W
Question
Which are true and which are false?
1. A Scanner class can be used to read in user input.
2. Example syntax for creating a Scanner to read user input is:
Scanner input = new Scanner("System.in");
3. The println() statement can be used to provide a prompt to the user.
4. When using printf(), you can use %d as the format specifier for an int type.
5. An import statement, such as the one to import java.util.Scanner should be the very last line in an application.
6. You should always declare your instance variables as type public.
7. Getters are used to set the value of private instance variables.
8. Your application can use a getter to get the current value of an instance variable of an object that your application has created.
9. You must always have an else part for every
Explanation / Answer
1.
True
2.
True
3.
True
4.
True
5.
False
6.
False
7.
False
8.
True
9.
False
10.
True
11.
False
12.
True
13.
True
14.
False
15.
True
16.
False
17.
False
18.
True
19.
False
20.
True
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.