Results 1 to 3 of 3
  1. #1
    juxta is offline Member
    Join Date
    Nov 2011
    Posts
    30
    Rep Power
    0

    Default Can't seem to get my array table to show up :(

    Hi guys, here's a link to a section of my code:

    >>>> Link Removed<<<< Please post code here

    Whenever i run my program, the inputs work, but I get this error saying
    "Exception in thread "main" java.lang.NullPointerException
    at game.printGrid(game.java:66)
    at gameUser.main(gameUser.java:25)"

    In my user class game, I call the method from the other class to show output. Here is my code of calling the method.

    gameObject = new game(1, 2);
    gameObject.enterValue();
    gameObject.printGrid();
    Last edited by Norm; 12-13-2011 at 02:06 AM.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,412
    Rep Power
    25

    Default Re: Can't seem to get my array table to show up :(

    Exception in thread "main" java.lang.NullPointerException
    at game.printGrid(game.java:66)
    There is a variable with a null value at line 66 in the program. Look at line 66 and see what variable is null and backtrack in the code to see why that variable does not have a valid value. If you can not see which variable is null add a println statement just before line 66 and print out all the variables used on line 66.

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default Re: Can't seem to get my array table to show up :(

    Look at the following line numbers in your code.

    at game.printGrid(game.java:66)
    at gameUser.main(gameUser.java:25)"
    Try to manipulate them logically and see what is the result in each steps. Use of a paper and pencil make sense a lot. Then you can find the solutions yourself while learning something new. If you don't know what is the exception means, please have a look at the Java Doc.

Similar Threads

  1. how to fill and show an array with graphic components?
    By randomjavaguy in forum New To Java
    Replies: 2
    Last Post: 11-08-2010, 09:19 AM
  2. array table and paint?
    By reik6149 in forum New To Java
    Replies: 1
    Last Post: 09-16-2010, 01:55 PM
  3. NFL 2D array standings table
    By ber1023 in forum New To Java
    Replies: 5
    Last Post: 01-07-2010, 04:45 AM
  4. Data from a model class won't show up in the table
    By ayampanggang in forum AWT / Swing
    Replies: 3
    Last Post: 11-27-2008, 08:20 PM
  5. String array for Choice, JOptionPane doesn't show
    By themburu in forum Java Applets
    Replies: 5
    Last Post: 05-29-2008, 01:10 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •