aspose file tools*
The moose likes Beginning Java and the fly likes while loop question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "while loop question" Watch "while loop question" New topic
Author

while loop question

Jesse Crockett
Ranch Hand

Joined: Feb 03, 2005
Posts: 129
Take a look at this code...



Why do I get "stuNameList variable may not have been initialized"?

How come it doesn't know it's a string?
Jesse Crockett
Ranch Hand

Joined: Feb 03, 2005
Posts: 129


This works!
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

String stuNameList, stuName;
while {
...
stuNameList = stuNameList + "\n" + stuName;
}

stuNameList is not initialized the first time you loop, so you can't use stuNameList + "\n"


[My Blog]
All roads lead to JavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: while loop question