?
package com.codegym.task.task15.task1522;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.*;
/*
Reinforce the singleton pattern
*/
public class Solution implements Planet {
public static void main(String[] args) {
}
public static Planet thePlanet;
// Add static block here
static {
try {
readKeyFromConsoleAndInitPlanet();
}
catch(IOException e)
{
}
}
public static void readKeyFromConsoleAndInitPlanet() throws IOException {
// Implement step #5 here
BufferedReader rd = new BufferedReader(new InputStreamReader(System.in));
String s = rd.readLine();
if(s.equals(Planet.SUN))
thePlanet = Sun.getInstance();
else if(s.equals(Planet.MOON))
thePlanet = Moon.getInstance();
else if(s.equals(Planet.EARTH))
thePlanet = Earth.getInstance();
else
thePlanet = null;
}
}