Q:

Java: value of parameter doesn't change

I just started with Java and to learn it I was trying to program a Tamagotchi in BlueJ. This is an extract of the code:
public class Tamagotchi
{
    private int hunger;
    private int mood;
    private int fatigue;
    private int hBorder;
    private int mBorder;
    private int fBorder;
    private String generalCondition;

    public Tamagotchi(int hungerBorder, int moodBorder, int fatigueBorder)
    {
        // Instanzvariable initialisieren
        hunger = 0;
        mood = 0;
        fatigue = 0;
        hBorder = hungerBorder;
        mBorder = moodBorder;
        fBorder = fatigueBorder;
        generalCondition = "indifferent";
    }

    public void setGeneralCondition(){
        if (fatigue > fBorder){
            generalCondition = "tired";
        }
            if ((fatigue < fBorder) & (hunger > hBorder)){
                generalCondition = "hungry";
            }
                if ((mood > mBorder) & (hunger < hBorder) &
                (fatigue < fBorder)){
                    generalCondition = "happy";
                }
        else {
            generalCondition = "indifferent";
        }
    }

    public void play()
    {
        if (hunger > hBorder){hunger += 2; mood += 2; fatigue += 3;
        }
        else {}
        setGeneralCondition();
    }

    public void eat(){
        if (fatigue > fBorder){hunger -= 2; fatigue += 2;
        }
        else{}
        setGeneralCondition();
    }

   public void sleep(){
        if (hunger > hBorder){hunger += 1; mood -= 1; fatigue = 0;
        }
        else{hunger += 1; mood += 1; fatigue = 0;
        }
        setGeneralCondition();
    }

    public void pet(){
        hunger += 1;
        mood += 2;
        setGeneralCondition();
    }

    public String getGentralCondition(){
        return generalCondition;
    }

    public void makeHappy(){
        eat();
        sleep();
    }
}

My problem is that the generalCondition does not change when I use any of the methods. I think something with the method setGeneralCondition is wrong but I don't know where the problem is. Can somebody help :/ ?
THX in advance.
EDIT:
I posted the hole code now. As I said in the comment: I want the generalCondition to change whenever I use a method like eat(), play()...
The method setGeneralCondition was supposed to check if one of the values hunger mood or fatigue passes a certain border and change the Condition (to tired, hungry or happy). But whenever I use one of the other methods the generalCondition doesn't change.

A:

EDIT: I have made further edits to your code and have come up with a little main that runs your code and changes generalCondition! Check it out and run it for yourself to see.
My intuition tells me this class Tamagotchi is a class file or an object Tamagotchi that will be used by a main method that rests somewhere in another file.  If that is the case, I believe it is a simple fix and all you need to do is add this. in a lot of places.  I have gone ahead and done just that for you below.  Try this and let me know if this works!
public class Tamagotchi{
    private int hunger;
    private int mood;
    private int fatigue;
    private int hungerBorder;
    private int moodBorder;
    private int fatigueBorder;
    private String generalCondition;

    public Tamagotchi(int hungerBorder, int moodBorder, int fatigueBorder)
    {
        // Instanzvariable initialisieren
        this.hunger = 30;
        this.mood = 30;
        this.fatigue = 30;
        this.hungerBorder = hungerBorder;
        this.moodBorder = moodBorder;
        this.fatigueBorder = fatigueBorder;
        this.generalCondition = "indifferent";
    }

    public void setGeneralCondition(){
        if (fatigue > fatigueBorder){
            this.generalCondition = "tired";
            return;
        }
        if ((fatigue < fatigueBorder) && (hunger > hungerBorder)){
            this.generalCondition = "hungry";
            return;
        }
        if ((mood > moodBorder) && (hunger < hungerBorder) && (fatigue < fatigueBorder)){
            this.generalCondition = "happy";
            return;
        } else {
            this.generalCondition = "indifferent";
        }
    }

    public String getGeneralCondition(){
        return generalCondition;
    }

    public void play()
    {
        if (!generalCondition.equalsIgnoreCase("hungry")){
            hunger += 2; mood += 2; fatigue += 3;
        } else {
        }
        setGeneralCondition();
    }

    public void eat(){
        if (fatigue > fatigueBorder){
            hunger -= 2; fatigue += 2;
        } else{
        }
        setGeneralCondition();
    }

    public void sleep(){
        if (hunger > hungerBorder){
            hunger += 1; mood -= 1; fatigue = 0;
        } else{
            hunger += 1; mood += 1; fatigue = 0;
        }
        setGeneralCondition();
    }

    public void pet(){
        hunger += 1;
        mood += 2;
        setGeneralCondition();
    }

    public void makeHappy(){
        eat();
        sleep();
    }
}

Here is a little main method I wrote to test the code above.
public class Test {
    public static void main(String[] args) {
        Tamagotchi test = new Tamagotchi(10, 10, 10);
        test.play();
        test.makeHappy();

        System.out.println(test.getGeneralCondition());
    }
}

Output :
hungry

Hope this helps!
P.S. here is a link to basic coding styles.  Practice coding with these styles as it makes your code easier to read for others, yourself, it looks a lot cleaner, and it is easier to see and fix errors! Coding Style Guide

