Please fix your compiler because I wrote the program well and your compiler doesn't accept it.
package pl.codegym.task.task15.task1522;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/*
Praca nad wzorcem projektowym singleton
*/
public class Solution {
public static void main(String[] args) {
}
public static Planet thePlanet;
// Dodaj tutaj blok statyczny
static {
readKeyFromConsoleAndInitPlanet();
}
public static void readKeyFromConsoleAndInitPlanet() {
// Zaimplementuj tutaj krok #5
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
try{
String string = reader.readLine();
switch (string){
case Planet.SUN: {
thePlanet = Sun.getInstance();
}
break;
case Planet.EARTH: {
thePlanet = Earth.getInstance();
}
break;
case Planet.MOON:{
thePlanet = Moon.getInstance();
}
default:{
thePlanet = null;
}
}
}catch (IOException e){
System.out.println(e);
}
}
}