Why it is said that use of enums is better in java. In case if you have constants for which datatypes are different I think it is better to use class with constants instead of enums?
Like
Class A {
public static int A = 1;
public static int B = 2;
public static String c = "RADIUS";
public static String d = "LENGTH";
}
instead of
enum ofInts {A(1), B(2)}
enum ofStrings{c("RADUIS"), d("LENGTH")}
One benefit of using enums is that it's strongly typed. Consider two sets of constants, both of which have integer representations. If you just use fields as you've proposed, there's nothing to stop you from passing the wrong kind of value into methods etc. If you use enums, you can't - the two sets of constants are entirely distinct, even though they share the common aspect of "values with underlying integer representations".
Of course, enums provide additional benefits in allowing you to include behaviour for the values, but that's not always necessary - and even when it's not, that doesn't mean that enums aren't useful.
See more on this question at Stackoverflow