title: Read elements from a file and store them in ArrayList as Objects
body: <p>I have a file contains (string, int, floating, char)</p>
  
  <p>12</p>
  
  <p>1.8</p>
  
  <p>a</p>
  
  <p>John</p>
  
  <p>23.5</p>
  
  <p>I want to read them an store them in an ArrayList. My ArrayList type is object. But, still I get exceptions when I run it.</p>
  
  <pre><code>    public static void main(String [] args) throws IOException{
  
  
      try{
              FileReader a=new FileReader("src/SET_A.txt");
              Scanner b=new Scanner(a);
              ArrayList&lt;Object&gt; c=new ArrayList&lt;Object&gt;();
              while(b.hasNextLine())
                  {
                      Object d=b.nextInt();
                      c.add(d);
                   }
              System.out.println("The content of arraylist is: " + a);
      }
      catch(Exception exception)
      {
          exception.printStackTrace();
      }
      }
  </code></pre>