System.out.print(">> ");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String input = br.readLine();
I would like to name a variable (double input=new double[5];) with the name the program gets from BufferedReader. How to do that?
You can’t do it. Variable are defined at compile-time. And you don’t need it – how would you access variables with dynamic names?
You can use a
Map<String, double[]>to map a string to a double array.map.put(name, array)and thenmap.get(name)will give you the array.