title: How can I use Scanner in Java to read specific characters in a text file?
body: <p>Basically, I am trying to read 4 characters from a sequential text file. The first two are ints that I will declare to a variable, and the next 2 are characters that I need to either assign to a String or a character so I can print them out later.</p>
  
  <p>I know how to get the ints, but my main problem with reading the characters is that I am not sure how to, and there is a possibility that ones of the characters can be a ' ', or just a space. I have no idea how I'm supposed to get a space as a character. I need to use the characters later in the program to print something.</p>
  
  <p>So far I've pretty much just done something like</p>
  
  <pre><code>Scanner s = new Scanner(new FileInputStream("textfile.txt"));
  
  int a = s.nextInt();
  int b = s.nextInt();
  </code></pre>
  
  <p>But then I get errors if I try to use next, especially if I'm trying to get a ' ' character. Any help please?</p>