Why does the following work fine?
String str; while (condition) { str = calculateStr(); ..... }
But this one is said to be dangerou
if you want to use str outside looop also; declare it outside. otherwise, 2nd version is fine.
str