Java OCA OCP Practice Question 28

Question

Which methods return an enum constant's name?

  • A. getName()
  • B. name()
  • C. toString()
  • D. nameString()
  • E. getNameString()


B, C.

Note

Both name() and toString() return a constant's name. name() is final, but toString() can be overridden.




PreviousNext

Related