I am retrieving values from database. I initialized a variable outside the loop. I am using while loop to move one record after other to last using ResultSet object.next(). Inside the while I am assigning the record value to the variable initialized outside while. But It shows variable might not have been initialized error inside while and in succeeding code wherever that variable is used.
If I move them as class variable outside the method too i got error "Non Static variable cannot be initialized from static context".