Q:

ArrayList Cannot find variable isJunior

I'm trying to call a boolean varible from another class to a class which contains an arraylist. The purpose of the method below is to add a student to the team, and if the student falls under a certain age (eg 18) they receive a discount. 
Here is the code for the boolean result of whether a student is a Junior or not:
public boolean isJunior()
{
   return age < 18;
}

The arraylist class contains a method sighUp() which adds a student to the team list. if the student is a junior they receive a discount:
public void signUp(Student jj)
{
   team.add(jj);
   points = points + 1;
   if (Student.isJunior = true)
   {
      totalCosts = totalCosts + (cost / 2);
   }

The error I keep getting is 'isJunior' is a variable that cannot be found. I am trying to call this method from the student class which contains the boolean variable. Anyone to shed some light on this? Much appreciated. 

A:

I guess what you want is 
 if (jj.isJunior())

This invokes the method isJunior() on the Student instance jj. The method returns a boolean. This boolean is evaluated by the if statement.
You don't need an additional == true, because
 jj.isJunior() == true

is a boolean expression that evaluates to true if the return value of isJunior() is true. Thus the boolean expression's result is the same as the boolean value returned by isJunior() itself.

