Java OCA OCP Practice Question 2147

Question

Which classes in the Java API provide both forms of the format() method?

format(String formatStr, Object... args)
format(java.util.Locale l, String formatStr, Object... args)

    

Select the four correct answers.

  • (a) java.lang.String
  • (b) java.util.StringBuilder
  • (c) java.io.PrintStream
  • (d) java.io.PrintWriter
  • (e) java.util.Scanner
  • (f) java.util.Formatter
  • (g) java.util.Console


(a), (c), (d), and (f)

Note

The classes java.util.StringBuilder and java.util.Scanner do not provide the format() method.

The Console class only provides the first form.




PreviousNext

Related