Every where over the internet, people are professing that IOC approach is better than non IOC approach as it decouple your classes from their dependencies so that the dependencies can be replaced or updated with minimal or no changes. Refer below
java programs, one using the IOC approach (file 1, 3 and 4) and another without using the IOC approach (file 1 and 2).
File 1 - Test.java [POJO]
File 2 - Client.java [Without using IOC Container]
File 3 - Client.java [Using IOC Container: ApplicationContext]
File 4 - spring.xml
No matter whichever approach we follow, we will get the same result "Hello Mr. Rahul". Can anyone please guide as what benefits the IOC approach is offering (in context with the source code shared above) which non IOC approach isn't.