Thread: Seemingly simple issue?

Results 1 to 4 of 4
  1. #1 Seemingly simple issue? 
    Registered Member
    Join Date
    Jan 2015
    Posts
    34
    Thanks given
    5
    Thanks received
    0
    Rep Power
    11
    In my player class, I define the freeSlots integer with the following code:

    Code:
     	public int freeSlots() {
    		int freeslots = 0;
    		for (int i = 0; i < playerItems.length; i++) {
    			if (playerItems[i] <= 0) {
    				freeslots++;
    			}
    		}
    		return freeslots;
    	}
    And, obviously, I'm importing all of the variables from my Player class into my Commands class with the following statement:
    Code:
     import server.model.players.Player;
    However, when I attempt to use the freeSlots method in my Commands class, I'm not allowed to. It seems like a simple issue, but I'm not exactly sure what to do, and I would appreciate the help.

    Thanks!
    ~Team
    Reply With Quote  
     

  2. #2  
    Member of the Imagine Cult

    Join Date
    Feb 2013
    Posts
    519
    Thanks given
    21
    Thanks received
    7
    Rep Power
    59
    because it is not static.

    First I'd recommend adding it into Items.java, and calling it:
    Code:
    c.getItems().freeSlots()
    Reply With Quote  
     

  3. Thankful user:


  4. #3  
    Registered Member
    Join Date
    Jan 2015
    Posts
    34
    Thanks given
    5
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by FiveRiverFlo View Post
    because it is not static.

    First I'd recommend adding it into Items.java, and calling it:
    Code:
    c.getItems().freeSlots()
    Thanks bro!
    Reply With Quote  
     

  5. #4  
    Member of the Imagine Cult

    Join Date
    Feb 2013
    Posts
    519
    Thanks given
    21
    Thanks received
    7
    Rep Power
    59
    Quote Originally Posted by team 14 cape View Post
    Thanks bro!
    Anytime
    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

Similar Threads

  1. Simple issue
    By Archive in forum Application Development
    Replies: 1
    Last Post: 01-11-2014, 10:45 PM
  2. Eclipse IDE simple Issue.
    By Grown in forum Application Development
    Replies: 12
    Last Post: 08-15-2013, 11:14 PM
  3. Replies: 7
    Last Post: 10-30-2011, 11:47 PM
  4. Really simple issue
    By Kylestanger in forum Help
    Replies: 3
    Last Post: 08-10-2011, 02:55 PM
  5. Really simple issue
    By Kylestanger in forum Help
    Replies: 3
    Last Post: 08-05-2011, 09:57 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
  •