I have troubles returning a value from a loop in method.
I've tried this way: (which returns classname
, my initialise String instead of classes.get(i).className
)
public String getClassName(){
String cName = "classname";
for (int i=0; i<classes.size(); i++){
cName = classes.get(i).className;
}
return cName;
}
and I've tried this as well: (which returns c
instead of classes.get(i).className
)
public String getClassName(){
String cName = "classname";
String c = "c";
for (int i=0; i<classes.size(); i++){
c = classes.get(i).className;
}
cName = c;
return cName;
}
Please tell me how to return classes.get(i).className
!! Thanks a lot :P