You need to sign in to do that
Don't have an account?
pelika Gupta 2
Size of list increasing on adding elements to it
I have defined a list and gave it size of 6. On adding two elements in it by using list.add() method, the size of list is increasing. Why the size of list is increasing? Shouldnt it remain same?
Kindly find the snapshot of the coding.
Kindly find the snapshot of the coding.
set(Insex,element)
All Answers
set(Insex,element)
As vijayabakarareddy suggested, use the set() method, instead of the add() method, which makes an in-place change and replaces the existing values.
Thanks,
Satish Kumar