I'm stuck here. Not sure why this wouldn't be working.
package com.codegym.task.task15.task1529;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/*
Mastering the static block
*/
public class Solution {
public static void main(String[] args) {
}
static {
try {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String value = br.readLine();
if (value.equalsIgnoreCase("helicopter")) {
result = new Helicopter();
} else if (value.equalsIgnoreCase("plane")) {
int passengers = Integer.parseInt(br.readLine());
result = new Plane(passengers);
}
br.close();
} catch (IOException e) {
e.printStackTrace();
}
reset();
}
public static CanFly result;
public static void reset() {
result = null;
}
}