fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. private static Locale turkishLocale = new Locale("tr", "TR");
  11.  
  12. private static enum Type {
  13. WAIT,
  14. CANCEL,
  15. MODIFY,
  16. AUTH,
  17. CONTINUE;
  18.  
  19. @Override
  20. public String toString() {
  21. return name().toLowerCase(turkishLocale);
  22. }
  23.  
  24. public static Type fromString(String string) {
  25. string = string.toUpperCase(turkishLocale);
  26. return Type.valueOf(string);
  27. }
  28. }
  29.  
  30. public static void main (String[] args) throws java.lang.Exception
  31. {
  32. Type.fromString("wait");
  33. }
  34. }
Runtime error #stdin #stdout #stderr 0.1s 320576KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Exception in thread "main" java.lang.IllegalArgumentException: No enum constant Ideone.Type.WAİT
	at java.lang.Enum.valueOf(Enum.java:238)
	at Ideone$Type.valueOf(Main.java:12)
	at Ideone$Type.fromString(Main.java:26)
	at Ideone.main(Main.java:32)