Hi
I don't understand what is going wrong in my code. It seems the plane object can't be created.
Thanks for any hints
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 {
static BufferedReader re = new BufferedReader(new InputStreamReader(System.in));
public static void main(String[] args) {
}
static {
//write your code here
reset();
}
public static CanFly result;
public static void reset() {
//write your code here
String s;
try{
s = re.readLine();
if(s.equals("helicopter")){
result = new Helicopter();
}
else if(s.equals("plane")){
int passengers = Integer.parseInt(re.readLine());
result = new Plane(passengers);
}
re.close();
}catch(IOException e){
}
}
}