Thread: Identifier Required. (please help)

Results 1 to 5 of 5
  1. #1 Identifier Required. (please help) 
    Bars
    Guest
    .\Server\Server.java:54: <identifier> expected
    public static itemHandler = new ItemHandler();
    ^
    .\Server\Server.java:55: <identifier> expected
    public static playerHandler = new PlayerHandler();
    ^
    .\Server\Server.java:56: <identifier> expected
    public static npcHandler = new NPCHandler();
    ^
    .\Server\Server.java:57: <identifier> expected
    public static shopHandler = new ShopHandler();
    ^
    .\Server\Server.java:58: <identifier> expected
    public static worldObject = new WorldObject();
    ^
    .\Server\Server.java:59: <identifier> expected
    public static objectHandler = new ObjectHandler();
    ^

    If someone could please tell me how to fix this.. Ive tried for about 15 minutes now and haven't found a solution.. Im sure it's easy but I sure as hell cant find out how to fix it.
    Reply With Quote  
     

  2. #2  
    Renown Programmer
    Method's Avatar
    Join Date
    Feb 2009
    Posts
    1,455
    Thanks given
    0
    Thanks received
    843
    Rep Power
    3019
    Post your code and perhaps someone can help you out.
    Reply With Quote  
     

  3. #3  
    Bars
    Guest
    }

    public static Server clientHandler = null;
    public static java.net.ServerSocket clientListener = null;
    public static boolean shutdownServer = false;
    public static boolean shutdownClientHandler;
    public static int ServerlistenerPort = 43594;
    public static itemHandler = new ItemHandler();
    public static playerHandler = new PlayerHandler();
    public static npcHandler = new NPCHandler();
    public static shopHandler = new ShopHandler();
    public static worldObject = new WorldObject();
    public static objectHandler = new ObjectHandler();

    public void run() {
    Reply With Quote  
     

  4. #4  
    Renown Programmer
    Method's Avatar
    Join Date
    Feb 2009
    Posts
    1,455
    Thanks given
    0
    Thanks received
    843
    Rep Power
    3019
    EDIT: Nevermind.
    Reply With Quote  
     

  5. #5  
    Sanadis
    Guest
    Quote Originally Posted by Bars View Post
    }

    public static Server clientHandler = null;
    public static java.net.ServerSocket clientListener = null;
    public static boolean shutdownServer = false;
    public static boolean shutdownClientHandler;
    public static int ServerlistenerPort = 43594;
    public static itemHandler = new ItemHandler();
    public static playerHandler = new PlayerHandler();
    public static npcHandler = new NPCHandler();
    public static shopHandler = new ShopHandler();
    public static worldObject = new WorldObject();
    public static objectHandler = new ObjectHandler();

    public void run() {
    These following are fine.
    Code:
    	public static Server clientHandler = null;			
    	public static java.net.ServerSocket clientListener = null;
    	public static boolean shutdownServer = false;		
    	public static boolean shutdownClientHandler;			
    	public static int ServerlistenerPort = 43594;
    But you are tring to create a new instance of a handler, and you are going about it the wrong way.

    Code:
    	public static itemHandler = new ItemHandler();
    	public static playerHandler = new PlayerHandler();
            public static npcHandler = new NPCHandler();
    	public static shopHandler = new ShopHandler();
            public static worldObject = new WorldObject();
    	public static objectHandler = new ObjectHandler();
    In the way you are tring to do it here, that should look like this

    Code:
    	public static ItemHandler itemHandler = new ItemHandler();
    	public static PlayerHandler playerHandler = new PlayerHandler();
            public static NPCHandler npcHandler = new NPCHandler();
    	public static ShopHandler shopHandler = new ShopHandler();
            public static WorldObject worldObject = new WorldObject();
    	public static ObjectHandler objectHandler = new ObjectHandler();

    Or you can do this:
    Declare outside of your methods
    Code:
    	public static ItemHandler itemHandler = null;
    	public static PlayerHandler playerHandler = null;
            public static NPCHandler npcHandler = null;
    	public static ShopHandler shopHandler = null;
            public static WorldObject worldObject = null;
    	public static ObjectHandler objectHandler = null;
    And inside of your main method
    Code:
    	itemHandler = new ItemHandler();
    	playerHandler = new PlayerHandler();
            npcHandler = new NPCHandler();
    	shopHandler = new ShopHandler();
            worldObject = new WorldObject();
    	objectHandler = new ObjectHandler();
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Tags for this Thread

View Tag Cloud

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