/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
System.
out.
println("IOS1 class name = " + IosDevice.
IOS1.
getClass().
getName()); System.
out.
println("IOS1 base class name = " + IosDevice.IOS1.getClass().getSuperclass().getName());
IosDevice myIosDevice = IosDevice.IOS1;
System.
out.
println(Arrays.
toString(myIosDevice.
getValues())); AndroidDevice myAndroidDevice = AndroidDevice.AND1;
System.
out.
println(Arrays.
toString(myAndroidDevice.
getValues())); }
}
enum IosDevice implements IDevice {
IOS1, IOS2;
public IDevice[] getValues() {
return IosDevice.values();
}
}
enum AndroidDevice implements IDevice {
AND1, AND2;
public IDevice[] getValues() {
return AndroidDevice.values();
}
}
interface IDevice {
//...
public IDevice[] getValues();
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KY2xhc3MgSWRlb25lCnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB0aHJvd3MgamF2YS5sYW5nLkV4Y2VwdGlvbgoJewoJCVN5c3RlbS5vdXQucHJpbnRsbigiSU9TMSBjbGFzcyBuYW1lID0gIiArIElvc0RldmljZS5JT1MxLmdldENsYXNzKCkuZ2V0TmFtZSgpKTsKCQlTeXN0ZW0ub3V0LnByaW50bG4oIklPUzEgYmFzZSBjbGFzcyBuYW1lID0gIgoJCQkrIElvc0RldmljZS5JT1MxLmdldENsYXNzKCkuZ2V0U3VwZXJjbGFzcygpLmdldE5hbWUoKSk7CgkJSW9zRGV2aWNlIG15SW9zRGV2aWNlID0gSW9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