Search:

Type: Posts; User: Norm

Search: Search took 0.11 seconds.

  1. Thread: Scanner Problem

    by Norm
    Replies
    8
    Views
    1,235

    Re: Scanner Problem

    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...
  2. Thread: Scanner Problem

    by Norm
    Replies
    8
    Views
    1,235

    Re: Scanner Problem

    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?
  3. Thread: Scanner Problem

    by Norm
    Replies
    8
    Views
    1,235

    Re: Scanner Problem

    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...
  4. Thread: Scanner Problem

    by Norm
    Replies
    8
    Views
    1,235

    Re: Scanner Problem

    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...
Results 1 to 4 of 4