Languages

Java enum valueOf uppercase or lowercase - does it matter when I use enum value of?

2 points
Asked by:
RomanaLittle
458

Does the size of letter matters when I use enum valueOf() method?

For example:

Can I use lowercase letters like "sent" when I use:

Or do I need to use exatch match?

1 answer
3 points
Answered by:
Root-ssh
178180

Exact match is required (example 1), if not then we will get exception (example 2).

Example 1

Output:

Example 2 - exception

Reference

0 commentsAdd comment
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join