java - I need.setText parameter to be recognized as method , not as a string -
i have problem following code:
question1.settext("question1_" + question_number() + "()");
i have multiple methods return string value , named "question1_x" (x number) , method question_number returns random number. when run code "question1" text set "question1_x()" , need set text "question1_x()" method returns it. ["question1_" + question_number() + "()"] seen ".settext" method , not string.
thank in advance :)
java won't let unless resort reflection. reflection wrong solution problem.
any time want have numbered methods and/or fields, step , consider using proper collection (say, list) instead. start replacing numbered methods single method takes number:
string question1(int questionnumber)
Comments
Post a Comment