Search:

Type: Posts; User: pbrockway2

Search: Search took 0.17 seconds.

  1. Re: NullPointerException Error in Code that Prints Array Elements

    Yes, you can't declare a variable twice.

    But in the code you were asking about (#5) only one variable is declared (other than the loop variables): alpha. And it is declared just once.

    The...
  2. Re: NullPointerException Error in Code that Prints Array Elements

    Yes, exactly.



    Where would you expect the error? The point is you *did* initialise both alpha and each of the alpha[i] elements. Everything initialised == no NullPointerException.

    Oddly,...
  3. Re: NullPointerException Error in Code that Prints Array Elements

    When you declare a variable of an array type ("Foo[] fooArr;") it will have the value null. (But in a method or constructor you simply can't use a variable you have declared there before it is...
  4. Re: NullPointerException Error in Code that Prints Array Elements

    Nice link, by the way.

    Near the bottom - and garnering zero votes :( - we read:

    "In Java every things is in the form of class.

    If you want to use any object then you have two phases
    ...
  5. Re: NullPointerException Error in Code that Prints Array Elements

    The NullPointerExpression will occur when you run the program. (Just a nitpick, but it pays to be precise...)

    Could you post the stack trace: the long message that you get at the console when an...
Results 1 to 5 of 5