collection question | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

collection question

In a Banking system what is the need of collection. if collection is needed to store object of every customer then why don't we store in sql

12th Apr 2017, 6:42 PM
Somnath Ghosh
Somnath Ghosh - avatar
3 Answers
+ 10
A collection stores objects/values only as long the code is running or - to be more precise - as long as a variable in use refers to it. After that it can be garbage collected and is lost. So, you're right... To store data permanently, you need to find another way (e.g. database or files).
12th Apr 2017, 7:04 PM
Tashi N
Tashi N - avatar
+ 1
be more specific. Is that an exercise? Or just a question that came up to your mind?
12th Apr 2017, 7:02 PM
Giannis Tsirovasilis
Giannis Tsirovasilis - avatar
0
giannis...i want to use collection in my project to learn.. i could not understand where can i use collection ?
13th Apr 2017, 5:57 PM
Somnath Ghosh
Somnath Ghosh - avatar