Computer Science Canada

output

Author:  Prince [ Wed Feb 18, 2004 11:15 am ]
Post subject:  output

i keep getting this error saying:
The variable "output" may be accessed here before having been definitely assigned a value.

wut the heck does that mean Confused ... heres the part im workin with
code:

    public String toString ()
    {
        String output;
        if (coeff > 1 || coeff < 1 && exp > 1 || exp < 1)
            output = "" + coeff + "x^" + exp;
        if (coeff == 1 && exp > 1 || exp < 1)
            output = "x^" + exp;
        if (coeff == -1 && exp > 1 || exp < 1)
            output = "-x^" + exp;
        if (coeff == 0 && exp == 0)
            output = "";
        if (coeff == 0 && exp > 1 || exp < 1)
            output = "x^" + exp;
        if (coeff == 1 && exp == 0)
            output = "1";
        if (coeff == -1 && exp == 0)
            output = "-1";
        return output;
    }

Author:  Dan [ Wed Feb 18, 2004 11:26 am ]
Post subject: 

it means tat output may never be give a value, it is a dum error tho.

just chage:

String output;

to

String output = "";


: