The variable: scanner needs to have the address of a Scanner object for the code to be able to call the Scanner class's nextIn() method. If scanner is null, you will het a NPE. Try this:
String...
Type: Posts; User: Norm
The variable: scanner needs to have the address of a Scanner object for the code to be able to call the Scanner class's nextIn() method. If scanner is null, you will het a NPE. Try this:
String...
You didn't answer this part of my question:
What object variable is on that line? Does it have a value?
Hint: there is only one object variable on that line: scanner. Does it have a value?
umur is an int variable. Primitive variables do not cause NPE. Only object variables can cause NPE when the code tries to use them to call a method for example.
What statement is line 41? What...
There is a variable on line 41 that has a null value when the code is executed. Look at line 41, find the variable with the null value and backtrack in the code to see why that variable does not...