title: Find the largest area of various Shape objects from an ArrayList
body: <p>Ideally I do not want it to be static or void. It is the only way I could get it to work at the moment. </p>
  
  <p>I have a Shape superclass. It has a method of area() which I @Override in the Rectangle class and Circle class. In my main method utilizing File IO. I am trying to make a method to iterate though my ArrayList of Shapes, to find the largest area(). </p>
  
  <p>I get a couple of different errors when I try different things. When I try something like, Shape largest = largest.get(0).area(); I get an error saying I cannot convert a double to a shape. </p>
  
  <p>I want to be able to get an area from my arrayList, and then compare it to other areas from that ArrayList, and do a sort method to find the largest and store it and return it. Also when I try returning it wont let me because it is not static. </p>
  
  <p>But I cant make my other methods static, that is not part of the design. 
  Following is a method I have been trying with a foreach, I know it is not right, but can I use it potentially? How can I get it to store the object I create e without overwriting it each time?</p>
  
  <p>If more code uploaded would be helpful please let me know. </p>
  
  <p>Java</p>
  
  <pre><code>public static void shapeWithLargestArea(ArrayList&lt;Shape&gt; shapes) {
  
       for(Shape e: shapes) {
           double largest = e.area();
             if (e.area() &gt; largest) {
                 largest = e.area();
             }
              System.out.println(largest);
       } // end for each loop
  
  
  } // end largest area method 
  </code></pre>