Page 1 of 1

About Question enthuware.ocpjp.v7.2.1184 :

Posted: Fri Nov 27, 2015 12:15 am
by evafang2008
What are the differences between autoboxing and type erasure?

If add option E "autoboxing", Can I select 'E autoboxing' as correct answer?

Thanks,

Re: About Question enthuware.ocpjp.v7.2.1184 :

Posted: Fri Nov 27, 2015 9:12 am
by admin
No, autoboxing applies only to primitive wrappers, while type erasure applies to all generic classes. For example,
If you have a method that takes a raw List as an argument, you can use that method in code that uses, says,

Code: Select all

List<String> i.e. 
List<String> names;
...
printNames(names); 

---
void printNames(List names){ ... }
HTH,
Paul.