Do not use == to equal the string, as it compares the objects, not the string itself.
Use num.equals ("end") or num.equalsIgnoreCase ("end") if you want to be able to enter end or END
"end" .equals(num), , -, .
, num null, , num.quals( "end" ) , if (num!= null && num.equals( "end" ) ) {...}
, "end" .equals(num) , - , , if (num!= null && num.equals( "end" )) {...}