public useEnums(SomeEnum a)
{
if(a.equals(SomeEnum.SOME_ENUM_VALUE))
{
...
}
...
}
When I tried to compare the two members of enum in Java like above, I wrote .equals() Looking at it
public useEnums2(SomeEnum a)
{
if(a == SomeEnum.SOME_ENUM_VALUE)
{
...
}
...
}
You can do == like this, too. I've been in Java for about 5 years, and I'm suddenly confused. I don't know what to write.
java enum
Both are grammatically correct. I use ==. It's safe when it's null.
576 Who developed the "avformat-59.dll" that comes with FFmpeg?
578 Understanding How to Configure Google API Key
924 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
614 GDB gets version error when attempting to debug with the Presense SDK (IDE)
573 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
© 2024 OneMinuteCode. All rights reserved.