title: Check if line is empty in java?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3247067/how-to-check-that-java-string-is-not-all-whitespaces">How to check that Java String is not all whitespaces</a>  </p>
  </blockquote>
  
  
  
  <pre><code>Scanner kb = new Scanner(System.in);
  String random;
  
  System.out.print("Enter your word: ");
  random = kb.nextLine();
  
  if (random.isEmpty()) {     
      System.out.println("No input detected!");                   
  } else {
      System.out.println(random);
  }
  </code></pre>
  
  <p>The above code doesn't account for when the user makes a space. It'll still print the blank line, when the user does a space and presses enter. </p>
  
  <p>How do I fix this? </p>