Searching...
Saturday, 2 November 2013

How to convert java enum to string ?

09:40

Example

package com.pretech;
public class EnumToStringExample {
	public static void main(String[] args) {
		String days = Days.MONDAY.name();
		System.out.println(days + "    " + days.getClass());
	}
}
enum Days {
	MONDAY
}

Output



MONDAY    class java.lang.String


0 comments: