title: How to make an array of objects of undefined length of a class with parameterized constructor in JAVA?
body: <pre><code>Scanner sc=new Scanner(System.in);
  System.out.println("Enter the number.");
  int n=sc.nextInt();
  PIDManager[] ob;
  for (int j=0;j&lt;n;j++)
  {   
      ob[j]=new PIDManager("Thread Number "+(j+1));
  }
  </code></pre>
  
  <p>Here <code>PIDManager</code> is a class, and the compiler shows an error that <code>ob</code> may not have been defined.</p>