Podcast
Questions and Answers
What is used in Java 5 and above to allow the user to enter their own values for the program?
What is used in Java 5 and above to allow the user to enter their own values for the program?
- Scanner class (correct)
- PrintStream class
- Hardcoded values
- BufferedReader class
What is the problem with the program Add2Numbers.java mentioned in the text?
What is the problem with the program Add2Numbers.java mentioned in the text?
- It doesn't use any classes
- It has a syntax error
- It always produces a result of 43 (correct)
- It asks for too much user input
Which package does the Scanner class belong to?
Which package does the Scanner class belong to?
- java.util (correct)
- java.awt
- java.lang
- java.io
What does the * in 'import java.util.*;' indicate?
What does the * in 'import java.util.*;' indicate?
What do you need to create first in order to use the Scanner class?
What do you need to create first in order to use the Scanner class?
Which class allows reading keyboard input in a convenient manner in Java?
Which class allows reading keyboard input in a convenient manner in Java?
Which method of the Scanner class is used to read in an integer?
Which method of the Scanner class is used to read in an integer?
What does the following line of code do: c = keyboardIn.next().charAt(0);
What does the following line of code do: c = keyboardIn.next().charAt(0);
How is a string literal defined?
How is a string literal defined?
In Java, how can you create an instance of the Scanner class?
In Java, how can you create an instance of the Scanner class?
What does the method keyboardIn.nextDouble()
do?
What does the method keyboardIn.nextDouble()
do?
How is a value assigned to a string variable in Java?
How is a value assigned to a string variable in Java?
What does the nextLine() method of the Scanner class do?
What does the nextLine() method of the Scanner class do?
Which class represents objects of string literals in Java?
Which class represents objects of string literals in Java?
What is used to construct a Scanner object for reading input from the keyboard?
What is used to construct a Scanner object for reading input from the keyboard?
What is used to represent the keyboard in Java?
What is used to represent the keyboard in Java?
Which method reads a line up until it reaches a white space?
Which method reads a line up until it reaches a white space?
What does the following line of code do: firstName = new String();
?
What does the following line of code do: firstName = new String();
?