enum day{ mon,tue}
enum getday(){
return day;
}
I want to print the day, like "mon" or "tue". Is it possible?
enum day{ mon,tue}
enum getday(){
return day;
}
I want to print the day, like "mon" or "tue". Is it possible?
Unless I'm mistaken, it's using the actual Java enum type, in which case you should be able to access the name attribute.
Something like day.getName() would be how you would typically do this in Java. In Java, it would return either "mon" or "tue" depending on the value of the enum instance being accessed.
Just invoke the name method. For example:
>>> from java.lang import *
>>> s = Thread.currentThread().getState()
>>> s
RUNNABLE
>>> type(s)
<type 'java.lang.Thread$State'>
>>> s.name()
u'RUNNABLE'