java - Value not initialized in if statement -
the below code has compiler error:
speedmsg might not been initialized
how can fix that?
string speedmsg;  // determine grade if (speed >= 150)   speedmsg = "stop! stop! please let me out!"; else if (speed <= 150)   speedmsg = "whew i'll walk here thanks.";      
change to:
// determine grade if (speed >= 150)     speedmsg = "stop! stop! please let me out!"; else     speedmsg = "whew i'll walk here thanks.";   that should enough let compiler sure variable initialized.