I did everything as the book says but it still not match one requirement
package com.codegym.task.task15.task1522;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/*
Reinforce the singleton pattern
*/
public class Solution {
public static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
public static void main(String[] args) {
}
public static Planet thePlanet;
static {
readKeyFromConsoleAndInitPlanet();
}
// Add static block here
public static void readKeyFromConsoleAndInitPlanet() {
// Implement step #5 here
try {
String s = reader.readLine();
switch(s) {
case Planet.SUN:
thePlanet = Sun.getInstance();
break;
case Planet.MOON:
thePlanet = Moon.getInstance();
break;
case Planet.EARTH:
thePlanet = Earth.getInstance();
break;
default:
thePlanet = null;
break;
}
} catch (IOException e) {
thePlanet = null;
}
}
}