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. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. String str = " " ; // "CoDe" ; // "bird" ; // "" ;
  13.  
  14. if ( str.isEmpty() ) { System.out.println( "ERROR - String has no characters." ); }
  15. else if ( str.isBlank() ) { System.out.println( "ERROR - String has only whitespace." ); }
  16. else if ( str.equals( "CoDe" ) ) { System.out.println( "Code received." ); }
  17. else { System.out.println( "ERROR - Incorrect entry." ); }
  18. }
  19. }
Success #stdin #stdout 0.09s 48964KB
stdin
Standard input is empty
stdout
ERROR - String has only whitespace.