Problem: The method getInstance() is wrong in the class Graph is wrong. Steps to reproduce: N/A Actual outcome: N/A Expected outcome: N/A
Wrong implementation: public static Graph getInstance() { if (instance != null) { return instance; } else { return new Graph(); } if (instance == null) instance = new Graph(); return instance; } Correct implementation: public static Graph getInstance() { if (instance == null) instance = new Graph(); return instance; }