This may be the first exception one find in his code
Yes, this is one of the first things a Java programmer need to interpret. To understand it fully, you need to learn objects and their references.
When you see a null pointer exception. You should go to the line specified in the error and check if there might be any null references there. To do that you can add basic "if statements" for your object references used around that line (just like goldhouse did for f variable in the above code.). Once you found the null reference variable, you can fix the problem by changing the code there. This step is application specific: you might need to make sure that no null reference is there or you can allow null references but control the program flow for not getting a null pointer exception.