Can we add premetive dt in LinkedList like we used to do in C?iguess not.. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Can we add premetive dt in LinkedList like we used to do in C?iguess not..

Objects in Linked List

31st Dec 2018, 7:49 AM
Sahil Bisht
Sahil Bisht - avatar
1 Answer
+ 4
if you use generics to parameterize the LinkedList like Linkedlist<Integer> = new..... then you can add int variables to it . Or you can use wrapper classes for each primitive dt to get their object version to use for lists and sets etc. For more information read up on wrapper classes, generics, autoboxing and unboxing.
31st Dec 2018, 9:10 AM
Asirap