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 answer on stackoverflow)
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.
The question..
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.
Object strings = new ArrayList();
strings.toString();
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