Gender Field in java
<p>Im creating an employee class containing three fields nem, age and gender. I need to create a gender field but the user can only choose male or female. I'm guessing I'm going to have to do this in boolean form but I don't know how I'm going to do that can anyone help me out please. </p>

<p>So far i have </p>

<pre><code>public class Employee {

private String name;
private int age;
private boolean gender;
private boolean male;
private boolean female;

public Employee(String name, int age, boolean gender) 
{
    this.name = name;
    this.age = age;

    boolean f = female;
    boolean m = male;

    if (gender = f)
    {
        System.out.print("female");
    }

    else if (gender = m)
    {
        System.out.print("male");
    }
}

public String getName() {
    return name;
}

public void setName(String name) {
    this.name = name;
}

public int getAge() {
    return age;
}

public void setAge(int age) {
    this.age = age;
}

public boolean isGender() {
    return gender;
}

public void setGender(boolean gender) 
{
    if (gender = f)
    {
        System.out.print("female");
    }

    else if (gender = m)
    {
        System.out.print("male");
    }
}
}
</code></pre>
