title: It only gives one string as the output
body: <p>If I enter 3 objects </p>
  
  <pre><code>aakash
  12323
  aakshit
  24r352
  rahul
  12323
  </code></pre>
  
  <p>If i give this as a input and enter search string as 'aa' then it gives only first string that matches the search ouput will be </p>
  
  <pre><code>aakash
  12323
  </code></pre>
  
  <p>why not aakshit also</p>
  
  <pre><code>import java.util.Scanner;
  import java.io.*;
  public class DA_2_searching {
      String name,phone_number;
      Scanner s = new Scanner(System.in);
      DA_2_searching()
      {
          System.out.print("Enter the Details");
          name=s.nextLine();
          phone_number= s.nextLine();
      }
      void search()
      {
         String search;
         search=s.nextLine();
         if(name.startsWith(search))
         {
             System.out.println(name);
             System.out.println(phone_number);
  
         }
      }
      public static void main(String args[])
      {
          int n;
          Scanner s = new Scanner(System.in);
          n= s.nextInt();
          DA_2_searching obj[]= new DA_2_searching[n];
  
          for(int i=0;i&lt;n;i++)
          {
              obj[i]= new DA_2_searching();
          }
          for(int i=0;i&lt;n;i++)
          {
              obj[i].search();
          }
  
      }
  }
  </code></pre>