title: How to print three different types of object of an array (in which any type of object is possible to store) and print it in separates arrays?
body: <p>I have the following codes and I want to modify it so that I can declare three arrays of the same type as objects that I have stored in the <code>ArrayList</code> (for instance arrays of types <code>Integer</code>, <code>Boolean</code>, <code>Double</code>), scan the <code>ArrayList</code> and each found object to its compatible array. How to do that?</p>
  
  <p>Please help me. Thank you in advance.</p>
  
  <pre><code>package task2;
  
  import java.io.ObjectInputStream;
  import java.util.ArrayList;
  
  public class Task2 {
  
      public static void main(String[] args) {
          ArrayList&lt;Object&gt; something=new ArrayList&lt;Object&gt;();
  
          //Array elements for integer type
          something.add(10);
          something.add(20);
          something.add(30);
          something.add(40);
          something.add(50);
          something.add(60);
  
          ////Array elements for boolean type
          something.add("The color of the sky is blue");
          something.add("The color of tree is green");
          something.add("The color of blood is red");
          something.add("The color of termeric is yello ");
          something.add("The color of dark is black");
          something.add("The color of watar is unknown ");
  
          ////Array elements for double type
          something.add("-10");
          something.add("-20");
          something.add("-30");
          something.add("-40");
          something.add("-50");
          something.add("-60");
          something.add("-70");
          something.add("-80");
  
  
          // Type code to print the integer type object
          System.out.println("Your array is with integer object:");
  
          for(int intcounter=0; intcounter&lt;5;intcounter++)
          {
              System.out.println(something.get(intcounter));
          }
  
          // Type code to print the boolean type object
          {
  
          }
  
          // Type code to print the boolean type object
          {
  
          }
      }
  }
  </code></pre>