Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 output
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Prince




PostPosted: 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;
    }
Sponsor
Sponsor
Sponsor
sponsor
Dan




PostPosted: Wed Feb 18, 2004 11:26 am   Post subject: (No subject)

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

just chage:

String output;

to

String output = "";
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: