The Chapter features the Scanner class, which is the new input option available in Java 5. Other options for input like the original Java class BufferedReader and the JOptionPane that were covered in previous versions of this text are no longer covered. Outputting information is something the students have already seen and done. However, this section deals with outputting in a way so that the information is formatted.
|Published (Last):||21 May 2017|
|PDF File Size:||13.60 Mb|
|ePub File Size:||14.70 Mb|
|Price:||Free* [*Free Regsitration Required]|
Upper Saddle River, NJ. All Rights Reserved. To use this constant you must import: a java. Locale b java. Currency c java. Properties d None of the above. E0" ; System. Answer:False 2 Every Java program automatically imports the java. Answer:True 4 The method printf is used the same way as the method println but has the added feature that allows you to add formatting instructions. Answer:False 5 The printf method can be used to output multiple formatted values.
Answer:True 6 The Scanner class has a method next that allows an entire line of string text to be read. Answer:False 7 Echoing input is good programming practice because it can reveal problems in the input.
Answer: System. Indicate the package you need to import. Include the necessary import statement to use the DecimalFormat class. Answer: import java. Answer: The pattern string represents the format in which the number passed to the DecimalFormat object is formatted.
The pattern can either specify the exact number of digits before and after the decimal, or it can specify the minimum numbers of digits. Answer:Prompting the user means to display a meaningful message to the user asking for some type of input. An example of prompting the user would be displaying a JOptionPane to ask the user to input their name. Answer:Echoing input is a technique that is commonly used to allow the user to check their input for accuracy before it is actually sent to the program for processing.
This technique reduces the chances of errors in the program. Answer:Importing only the classes you need into your program makes your program easier to read as well as aiding in documenting the program. Program readability is very important since humans read computer programs, too. Answer: The format specifiers d, f, e, and g are all used for numeric representation.
Specifier d represents a decimal integer, specifier f represents a fixed-point floating-point number, specifier e represents E-notation floating-point, and specifier g represents general floating-point in which Java secedes whether to use E-notation. The format specifiers s and c are used for string and character representation, respectively.
Answer: Whitespace is any string of characters, such as blank spaces, tabs, and line breaks, that prints as whitespace when written on white paper. Whitespace servers as delimiters for many of the Scanner class methods. All pages:.
0132830310 - Absolute Java 5th Edition by Savitch, Walter; Mock, Kenrick, Used