#Variable type useage

1 messages · Page 1 of 1 (latest)

jagged fern
#

why is an int being used as the variable type?

int choice = JOptionPane.showConfirmDialog(null, "Do you want to save changes?", "Confirmation", JOptionPane.YES_NO_CANCEL_OPTION);

orchid ventureBOT
#

<@&987246487241105418> please have a look, thanks.

waxen temple
#

Because that's what JOptionPane.showConfirmDialog(...) returns?

#

Maybe you need to explain why this doesn't fit your expectations.

keen dew
#

Java didn't always have enums if that's what you're getting at. It's just an old api

waxen temple
#

Swing (the desktop UI part of the Java library) was added in Java 1.2, and enums in Java 5.0 (some 5+ years later).