java - Declaring Linked Lists of a certain data type? -


sup guys reading things linked lists , stumbled along question:
following valid or invalid statement? explain answer. (we can assume using generics)

linkedlist <int> thelist = new linkedunorderedlist <int> (); 

** think it's valid statement because autoboxing occurs when declare int put list. meaning int becomes object of type int.

just want check of here if correct.or understanding of off.

you incorrect.

java generics work on objects. since int primitive not work.

as auto unboxing, occurs integer type when try , place int in int.


Comments

Popular posts from this blog

php - cannot display multiple markers in google maps v3 from traceroute result -

php - Boolean search on database with 5 million rows, very slow -

css - Text drops down with smaller window -