Question: Which println statement would you remove to stop this code throwing a null pointer exception?

  1. formatter.getClass()
  2. context.getClass()
  3. context.getBean("formatter").getClass()
  4. context.containsBean("formatter")

Answer: The correct answer of the above question is Option A:formatter.getClass()