Is it not possible to use <int> instead of <String> | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Is it not possible to use <int> instead of <String>

13th Jun 2018, 10:12 AM
Swastishree Dinesh Bhat
Swastishree Dinesh Bhat - avatar
3 Answers
+ 9
You would have to use the wrapper class Integer not the primitive int. Example LinkedList<Integer> x = new LinkedList<Integer>();
13th Jun 2018, 10:21 AM
David Akhihiero
David Akhihiero - avatar
13th Jun 2018, 1:10 PM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar
+ 3
yes tried it ..thanks
13th Jun 2018, 10:22 AM
Swastishree Dinesh Bhat
Swastishree Dinesh Bhat - avatar