title: How to create dynamic object for class in java?
body: <p>Ex:</p>
  
  <pre><code>Element elementInclude1 = doc.createElement("include");
  elementMethods.appendChild(elementInclude1);
  elementInclude1.setAttribute("name", "T1");
  
  Element elementInclude2 = doc.createElement("include");
  elementMethods.appendChild(elementInclude2);
  elementInclude2.setAttribute("name", "T2");
  
  Element elementInclude3 = doc.createElement("include");
  elementMethods.appendChild(elementInclude3);
  elementInclude3.setAttribute("name", "T3");
  ....
  </code></pre>
  
  <p>In the above example, number of objects(elementInclude1, elementInclude2,..) created are known dynamically. </p>
  
  <p>No of object required are known in run time, using that value iterating in the loop new object created in each iteration. how can I achieve that.</p>
  
  <p>Need to create objects elementInclude1, elementInclude2, elementInclude3,... dynamically while run time</p>
  
  <p>Just for better understanding I used some wrong practice in the below code.</p>
  
  <pre><code>String noOfObj = 5;
  for(int i = 1; i&lt;=noOfObj; i++)
  {
  Element elementInclude+**noOfObj** = doc.createElement("include");
  elementMethods.appendChild(elementInclude+**noOfObj**);
  elementInclude+**noOfObj**.setAttribute("name", "T1");
  }
  </code></pre>