Today I attend the interview I am a newbie to java, spring boot. The interviewer asked the question about garbage collectors. I said the garbage collector will release the unused resource. Then he asked about the IOC container, I said it take control of object creation and will inject into the dependent bean. Then he asked why we need to use an IOC container I said it will not create a new object every time it will use an existing one. Again he asked okay what is the issue in creating a new object because the garbage collector will release the memory then why should we go for IOC..? I am stuck here. Please help to understand this better