title: Theory : List declaration Object list = new ArrayList();
body: <p>I have an exam coming up that I'm studying for.. and I was thinking of an elegant way to answer the following question, my current answer would be something like (based on information from this <a href="https://stackoverflow.com/questions/2516778/java-how-to-have-an-arraylist-as-instance-variable-of-an-object">answer</a> on stackoverflow)</p>
  
  <blockquote>
    <p>The above initialization is not possible, it will compile but is missing an identifier in the declaration, and other functions such as add, remove will not be available.</p>
  </blockquote>
  
  <p>The question..</p>
  
  <blockquote>
    <p>Consider the following code snippet. Is it possible to assign an instance of ArrayList to a   variable declared as Object as done in line 1? Explain.</p>
  </blockquote>
  
  <pre><code>  Object strings = new ArrayList();
  
    strings.toString();
  </code></pre>
  
  <p>What are other ways to answer this? and could you please provide wikipedia/resources, so I can research further into how the compiler would translate this into bytecode?  Thank you</p>