Java Singleton Pattern Hackerrank Solution