I wrote a realy simple code based on another question and here it is:
It throws me an error
java.lang.NullPointerException line 5 and 17
I don't know what I'm doing wrong.
public class Main {
public static String bool(Boolean param){
if(param == true){ (line 5)
return "a";
}else if(param == false){
return "b";
}
return "c";
}
public static void main(String[] args){
System.out.println(bool(true));
System.out.println(bool(null)); (line 17)
System.out.println(bool(false));
}
}
See Question&Answers more detail:os