Question #15376

ArrayList<Double>a;
a=new ArrayList<Float>();

What is the error in the code segment?

Expert's answer

You must use only object types in generic class. Example:
a=new ArrayList<Float>() where Float - object type (float - simple type)

Likewise you must use Integer, Double, Long, Byte, String etc.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS