title: Scanner not working?
body: <p>I am new to Java and I am trying to make a Java app where it asks you to spell "Java" and if you spelled it correctly it will type "yes", however, it is typing "no", what am I doing wrong:</p>
  
  <pre><code>package quiz;
  import java.util.Scanner;
  public class quiz {
      public static void main(String[] args) {
          Scanner kirill = new Scanner(System.in);
          System.out.println(kirill.next());
          String kirill2 = "Java";
          if (kirill.equals(kirill2)){
              System.out.println("yes");
          }else{
              System.out.println("no");
          }
          System.out.println(kirill);
          kirill.close();
      }
  
  }
  </code></pre>
  
  <p>Running code:
  Java</p>
  
  <p>Java</p>
  
  <p>no</p>
  
  <blockquote>
    <p>java.util.Scanner[delimiters=\p{javaWhitespace}+][position=4][match valid=true][need input=false][source closed=false][skipped=false][group separator=\,][decimal separator=.][positive prefix=][negative prefix=\Q-\E][positive suffix=][negative suffix=][NaN string=\Q?\E][infinity string=\Q?\E]</p>
  </blockquote>