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.  
  11. public enum ServiceSource
  12. {
  13. NONE( "no_value" ),
  14. URL( "url" ),
  15. FILE( "file" );
  16. ServiceSource(String s){}
  17. public boolean isURL(){
  18. return (URL == this);
  19. }
  20. }
  21.  
  22. public static void main (String[] args) throws java.lang.Exception
  23. {
  24. ServiceSource one = ServiceSource.URL;
  25. ServiceSource two = ServiceSource.FILE;
  26. System.out.println(one.isURL());
  27. System.out.println(two.isURL());
  28. }
  29. }
Success #stdin #stdout 0.08s 380160KB
stdin
Standard input is empty
stdout
true
false