Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6

Thread: Error help

  1. #1
    New to the CF scene
    Join Date
    Aug 2019
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question Error help

    Hello. I'm trying to get this code to work but I keep running into these errors. I have a pretty good idea of what's wrong, but I'm struggling to pinpoint how to fix it.

    -errors.jpg

  2. #2
    Super Moderator vinyl-junkie's Avatar
    Join Date
    Jun 2003
    Posts
    3,471
    Thanks
    4
    Thanked 52 Times in 52 Posts
    Welcome to CodingForums, @monikathelover!

    Please post the actual code, not just a picture of it. You'll be more likely to get someone to help that way.
    Music Around The World - Collecting tips, trade and want lists, album reviews, & more

  3. Users who have thanked vinyl-junkie for this post:

    monikathelover (Aug 13th, 2019)

  4. #3
    New to the CF scene
    Join Date
    Aug 2019
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts
    package boardgametester;

    import games.board.*;
    import games.utilities.*;

    public class BoardGameTester {

    public static void main(String[] args) {
    FileManager.writeToFileAsync(ticTacToe.toString(),
    "ttt.txt");
    FileManager.writeToFileAsync(connectFour.toString(),
    "c4.txt");
    FileManager.writeToFileAsync(mastermind.toString() ,
    "mm.txt");
    }
    }

  5. #4
    New Coder
    Join Date
    Jan 2016
    Location
    Malaysia
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You forgot to declare ticTacToe,connectFour and mastermind.

  6. #5
    New to the CF scene
    Join Date
    Aug 2019
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Okay, I declared the variables, but now I'm getting new errors.

    package boardgametester;

    import games.board.*;
    import games.utilities.*;

    public class BoardGameTester {
    private static Void ticTacToe;
    private static Void connectFour;
    private static Void mastermind;

    public static void main(String[] args) {
    FileManager.writeToFileAsync(ticTacToe.toString(),
    "ttt.txt");
    FileManager.writeToFileAsync(connectFour.toString(),
    "c4.txt");
    FileManager.writeToFileAsync(mastermind.toString(),
    "mm.txt");
    }
    }

    run:
    Exception in thread "main" java.lang.NullPointerException
    at boardgametester.BoardGameTester.main(BoardGameTester.java:20)
    Java Result: 1
    BUILD SUCCESSFUL (total time: 3 seconds)

  7. #6
    New Coder
    Join Date
    Jan 2016
    Location
    Malaysia
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Can you tell us what your app suppose to do?


 

Tags for this Thread

Posting Permissions

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