собстввенно по сабжу. Ай нид хэлп, Данила....
package com.javarush.task.task15.task1522;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/*
Закрепляем паттерн Singleton
*/
public abstract class Solution {
public static void main(String[] args) {
}
public static Planet thePlanet;
//add static block here - добавьте статический блок тут
static {
readKeyFromConsoleAndInitPlanet();
}
public static void readKeyFromConsoleAndInitPlanet() {
// implement step #5 here - реализуйте задание №5 тут
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
try {
String string = reader.readLine();
if (string.equals(Planet.SUN)) thePlanet = Sun.getInstance();
else if (string.equals(Planet.MOON)) thePlanet = Moon.getInstance();
else if (string.equals(Planet.EARTH)) thePlanet = Earth.getInstance();
else thePlanet = null;
System.out.println(thePlanet);
}
catch (IOException e){
System.out.println(e);
}
}
}