In Python it's quite easy:
def function(variable_name,variable_value):
exec(str(variable_name) + "=" + str(variable_value))
exec()
converts string into code to run; in this case it creates a variable. I'm looking for something like this in Java:
static void method (String variable_name; String variable_value){
exec_eval_in_java("String " + variable_name + " = " + variable_value + ";");
}