5.18 – Regular Discussion Board #6

  1. Which is better to use for formatting output:  DecimalFormat or printf?  Why?   Which formatting method should you use for ALL programs in this class?  
  2. Give an example of how to use DecimalFormat in a program to format numeric data rounded to 5 decimal places with comma’s printed in proper places.  In your example set up the formatter with the formatting pattern and give an example of how to use it.
  3. Give an example of printf that displays integer data in fields of width 10.
  4. Give an example of printf that displays floating point data rounded to three decimal places with a comma in the proper spot.
  5. How is the switch different than the if else if else if based on your understanding?
  6. Based on your understanding what is the input problem with Scanner?  How do you fix it?
  7. How would you properly compare two Strings to make sure they are equal (So “John” and “John” are equal and “John” and “john” are not).
  8. Give an example of the conditional operator.
Scroll to Top