Results 1 to 2 of 2
  1. #1
    shahid860 is offline Member
    Join Date
    Jan 2012
    Posts
    1
    Rep Power
    0

    Post remove null poiter exception

    class EventManager
    {
    Game[] games=new Game[100];
    Player[] players;
    DaySchedule[] Schedules;

    int gamecounter=0;
    int daycounter=0;
    int playercounter=0;

    public String addgame(String name,int noOfPlayers)
    {
    if(gamecounter==games.length)
    {
    return"event has reached its limit";
    }
    for(int i=0;i<gamecounter;i++)
    {
    if(name.equals(games[i].getGameName()))
    {
    System.out.println("Game already exists");
    }
    }
    Game g=new Game(name, noOfPlayers);
    games[gamecounter++]=g;
    return "Game added";
    }






    public String addPlayer(String name,String[] gamename)
    {
    if(playercounter==players.length)
    {
    return"event has reached its limit";
    }
    for(int i=0;i<playercounter;i++)
    {
    if(name.equals(players[i].getPlayerName()))
    {
    System.out.println("player already exists");
    }
    }
    Player pname=new Player(name,gamename);
    players[playercounter++]=pname;
    return "player added";
    }



    }

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,123
    Rep Power
    20

    Default Re: remove null poiter exception

    Where?
    Don't expect people to run your code to find the exception.

Similar Threads

  1. Null Pointer Exception HELP!?
    By 2wyked in forum New To Java
    Replies: 3
    Last Post: 04-04-2011, 02:41 AM
  2. Replies: 1
    Last Post: 07-06-2010, 03:38 AM
  3. Null Pointer exception
    By diegoyj in forum New To Java
    Replies: 7
    Last Post: 01-29-2010, 05:17 PM
  4. Help with null pointer exception
    By gammaman in forum New To Java
    Replies: 4
    Last Post: 07-14-2009, 01:23 AM
  5. null pointer exception
    By jyothi.priyanka in forum New To Java
    Replies: 12
    Last Post: 03-11-2009, 06:04 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
  •