title: Splitting lines in text file using tab delimiter - Java
body: <p>I have a text file containing words and their corresponding meanings and each word-meaning pair is separated by two tab spaces</p>
  
  <pre><code>Cat     Animal with four legs
  Bus     Mean of transport
  NUST        University in asia
  Corolla     Car manufacturing company
  Chemistry       Science subject
  Cricket     Game played with bat and ball
  Camouflage      Hide or disguise the presence of any object
  </code></pre>
  
  <p>I want to read each line and split them by delimiter <code>\\t\\t</code> so that i can separate words from their meanings. Below is the function i wrote to do this </p>
  
  <pre><code>public static void readFile() {
       try{
           String line;
           String[] lineparts;
           Scanner pw = new Scanner(new BufferedReader(new FileReader("dictfile.txt")));
  
           while(pw.hasNext()) {
               line = pw.nextLine();
               lineparts = line.split("\\t\\t");
               System.out.println(lineparts[0]);
           }
  
       }catch(IOException ex){
  
           System.out.println(ex);
       }
  }
  </code></pre>
  
  <p>but the output is not as i expect. Array named <code>lineparts</code> which receives the returned strings from <code>split()</code> method should contain a word at its zero index and that word's meaning at its first index but the actual output is different.</p>
  
  <p><strong>Actual output</strong></p>
  
  <pre><code>Cat     Animal with four legs
  Bus     Mean of transport
  NUST        University in asia
  Corolla     Car manufacturing company
  Chemistry       Science subject
  Cricket     Game played with bat and ball
  Camouflage      Hide or disguise the presence of any object
  </code></pre>
  
  <p><strong>Expected output</strong></p>
  
  <pre><code>Cat  
  Bus     
  NUST        
  Corolla     
  Chemistry       
  Cricket     
  Camouflage
  </code></pre>
  
  <p>What am i doing wrong here and how can i achieve the expected output ?</p>