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