title: How does a null character (\u0000) end up in a string?
body: <p>I have a class in which there is a method that terminates the program in case a string has the NUL character in it. The particular expression is this:</p>
  
  <pre><code>stringVar.indexOf('\u0000') &lt; 0
  </code></pre>
  
  <p>This string is read from the user via Scanner and I really wonder how a NUL character may end up in the string through an input from the user.</p>
  
  <p>Edit: Scanner reads the code as follows:</p>
  
  <pre><code>Scanner scannerVar = new Scanner(System.in);
  stringVar = scannerVar.next();
  </code></pre>