java - How can I sort variable values, and then print them in order, largest to smallest? -
i sort list of variables, largest smallest, , print out names of variables. have tried arrays, when printing array out, prints out value of variables, not names.
printing out variable names lies somewhere between extremely tricky (on order of hunting through .class
files , hoping best) , downright impossible. if you, i'd use map
instead, can map variable values "names" in code, , can sort keys , print values in order.
the problems accessing variable names outlined in answers question linked, basic issue this: if have object no name defined it? if there's more 1 name single object?
Comments
Post a Comment