p.9
Using the Scanner Class for Input
What types of characters are considered whitespace?
Space, Tab, and Enter keys.
p.15
Message Dialog Types in JOptionPane
What is unique about JOptionPane.PLAIN_MESSAGE?
It displays a dialog that simply contains a message, with no icon.
p.3
Console Output Methods
What is the output of the following code: System.out.print("You must work hard");
It displays 'You must work hard' without moving to the next line.
p.8
Using the Scanner Class for Input
What is the function of the nextDouble() method?
It reads a real value of the double type.
p.5
Escape Characters in Java
What does the escape character '\n' do in Java?
It creates a new line in the output.
p.5
Escape Characters in Java
How is the escape character '\\' used in Java?
It allows you to print a backslash character.
p.9
Using the Scanner Class for Input
What happens when the input is 'Good Morning, Peter!'?
Only 'Good' is read as input.
p.3
Console Output Methods
What is the function of System.out.println in Java?
Displays a message and jumps to the next line.
p.18
Input Dialogs and Data Conversion
How is the midterm score converted from a string to an integer?
Using Integer.parseInt(input)
p.18
Message Dialog Types in JOptionPane
What type of message dialog is used to display the average score?
JOptionPane.INFORMATION_MESSAGE
p.7
Using the Scanner Class for Input
How is the average calculated in the provided code?
average = (midterm + finalExam) / 2.0;
p.10
Using the Scanner Class for Input
What is the purpose of the 'import java.util.*;' statement?
To import the Scanner class and other utility classes from the java.util package.
p.4
Escape Characters in Java
What does the escape sequence \n do?
It creates a newline, positioning the cursor at the beginning of the next line.
p.14
Message Dialog Types in JOptionPane
How can you display a warning message in a dialog box?
By using JOptionPane.WARNING_MESSAGE as a parameter.
p.8
Using the Scanner Class for Input
What does the nextLong() method read?
An integer value of the long type.
p.14
Using JOptionPane for Dialog Boxes
What is the purpose of the JOptionPane class in Java?
To create dialog boxes for user interaction.
p.9
Using the Scanner Class for Input
What is the purpose of the ReadWord class?
To demonstrate reading a single word input using Scanner.
p.8
Using the Scanner Class for Input
What does the method nextByte() do?
Reads an integer value of the byte type.
p.4
Escape Characters in Java
What is the purpose of the escape sequence \"?
It is used to display a double-quote character.
p.18
Using JOptionPane for Dialog Boxes
What method is used to display an input dialog in the GScore class?
JOptionPane.showInputDialog()
p.13
Console Output Methods
What are extension packages in Java?
New Java packages, such as javax.*.
p.15
Message Dialog Types in JOptionPane
What does JOptionPane.QUESTION_MESSAGE do?
It displays a dialog that poses a question to the user, requiring a response.
p.8
Using the Scanner Class for Input
What is the purpose of the nextInt() method?
It reads an integer value of the int type.
p.5
Escape Characters in Java
What is the purpose of the escape character '\t'?
It inserts a tab space in the output.
p.4
Escape Characters in Java
What is an escape character in Java?
A character prefixed with a backslash \ that represents a special character in a string.
p.17
Input Dialogs and Data Conversion
What is the purpose of the input dialog in the provided code?
To ask the user for the radius of a circle.
p.7
Using the Scanner Class for Input
What does the print statement 'System.out.print("Midterm? ");' do?
It prompts the user to enter the midterm score.
p.14
Message Dialog Types in JOptionPane
What type of message is shown in the TitledMessage class?
A warning message about failing a test.
p.20
Console Output Methods
What does 'END' signify in this context?
It indicates the conclusion of the document or content.
p.12
Using JOptionPane for Dialog Boxes
What can dialog boxes be used for?
To perform input and output.
p.13
Console Output Methods
What does the import statement 'import javax.swing.JOptionPane;' do?
It tells the compiler to load the class JOptionPane from the extension package javax.swing.
p.13
Console Output Methods
What are core packages in Java?
Packages included with the Java 2 Software Development Kit, such as java.*.
p.15
Message Dialog Types in JOptionPane
What is the purpose of JOptionPane.WARNING_MESSAGE?
It displays a dialog that warns the user of a potential problem.
p.4
Escape Characters in Java
What is the function of the escape sequence \t?
It inserts a horizontal tab, moving the cursor to the next tab stop.
p.17
Input Dialogs and Data Conversion
How is the input string converted to an integer?
Using Integer.parseInt(input).
p.3
Console Output Methods
What will be the output of the code snippet: System.out.println("to get a pass in");
It displays 'to get a pass in' and moves to the next line.
p.9
Using the Scanner Class for Input
What does the Scanner method kb.next() do?
It reads a String that ends before a whitespace character.
p.15
Message Dialog Types in JOptionPane
What type of message does JOptionPane.INFORMATION_MESSAGE display?
It displays a dialog with an informational message to the user.
p.3
Console Output Methods
What does System.out.print do in Java?
Displays a message and keeps the cursor at the end of the same line.
p.4
Escape Characters in Java
How does the escape sequence \ affect output?
It is used to print a backslash character.
p.3
Console Output Methods
What is the purpose of the OutputDemo class in the provided code?
To demonstrate the use of print and println methods for console output.
p.13
Console Output Methods
What is a package in Java?
A collection of related classes.
p.19
Confirm Dialogs in Java
What does the method showConfirmDialog return?
An integer representing the user's selection.
p.14
Using JOptionPane for Dialog Boxes
What does the 'null' parameter in showMessageDialog() represent?
It indicates that the dialog has no parent component.
p.8
Using the Scanner Class for Input
What type of value does nextFloat() read?
A real value of the float type.
p.20
Console Output Methods
What does '20 (C) VTC' refer to?
It likely refers to a course or document identifier from the Vocational Training Council.
p.7
Using the Scanner Class for Input
How do you create a Scanner object for keyboard input?
Scanner kb = new Scanner(System.in);
p.5
Escape Characters in Java
What effect does the escape character '\r' have in Java?
It returns the cursor to the beginning of the line.
p.10
Console Output Methods
What does the program output after reading the input?
"Your input is: " followed by the user's input.
p.8
Using the Scanner Class for Input
What type of value does nextShort() read?
An integer value of the short type.
p.3
Console Output Methods
What will be the complete output when running the OutputDemo class?
You must work hard to get a pass in ITP3914.
p.15
Message Dialog Types in JOptionPane
What does JOptionPane.ERROR_MESSAGE indicate?
It displays a dialog that indicates an error to the user.
p.4
Escape Characters in Java
What does the escape sequence \r accomplish?
It performs a carriage return, positioning the cursor at the beginning of the current line.
p.10
Console Output Methods
What is the output when the input is 'Good Morning, Peter!'?
Your input is: Good Morning, Peter!
p.8
Using the Scanner Class for Input
What is the purpose of the nextLine() method?
It reads a line (a String ended by pressing the Enter key).
p.18
Input Dialogs and Data Conversion
What is the formula used to calculate the average score in the GScore class?
(midterm + finalExam) / 2.0
p.5
Escape Characters in Java
What does the escape character '"' signify in a string?
It allows you to include double quotes within a string.
p.14
Using JOptionPane for Dialog Boxes
What method is used to display a simple message dialog?
JOptionPane.showMessageDialog()
p.12
Using JOptionPane for Dialog Boxes
What is the specific class to import for using JOptionPane?
import javax.swing.JOptionPane;
p.17
Input Dialogs and Data Conversion
What formula is used to calculate the area of a circle in the code?
area = radius * radius * Math.PI.
p.8
Using the Scanner Class for Input
What does the next() method do?
Reads a String that ends before a whitespace character.