title: Logical error with the statement 'sc.nextLine();'
body: <p>When I run this part of my program, it fails to recognize the two input statements using 'sc.nextLine();', but it accepts an entry for 'sc.next();'. Does anyone have any suggestions?   </p>
  
  <pre><code>String information()
  {
      int l;char at;String nam,id,number;long contact;
      System.out.println("\nPlease enter your name");
      nam=sc.nextLine();
      do
      {
          System.out.println("\nPlease enter your contact number");
          contact=sc.nextLong();
          number=Long.toString(contact);
          l=number.length();
          if(l&lt;5||l&gt;8&amp;&amp;l!=10)
              error();
      }
      while(l&lt;5||l&gt;8&amp;&amp;l!=10);
      System.out.println("\nPlease enter your e-mail id");
      id=sc.nextLine();
      int len=id.length();
      for(int k=0;k&lt;len;k++)
      {
          at=id.charAt(k);
          if(Character.isWhitespace(at))
          {
              error();
              break;
          }
      }
      return nam;
  }
  </code></pre>