Get object name of a class from the user in Java -
i want user enter name of object used in code. example, if have class public class person{ ....... } now instead of me creating object specific name like person student; i want user enter name object maybe teacher, , object teacher of class person created. not know if possible in java, many of solutions looked using map, explanations not clear enough me new java. so, if explain how can done code snippets wonderful. also please explain how hashmaps work in java , if can used implement problem above. grateful if explained code examples it's not possible. names of local variables not persistent in compiled class file. names of fields there, part of api, have modify class file runtime - , not want. with hashtable, may done this: hashtable<string, person> hashtable = new hashtable<>(); hashtable.put("student", new person()); then may "variable" by: person person = hashtable.get("student"); when guess trying do...