Objects do not have names.
Variables have names. A variable is not an object; it's important to understand the difference between variables and objects. A variable (of a non-primitive type) is a
reference to an object. You can have multiple variables that refer to the same object.
Also, you have to understand the difference between
compile time and
runtime.
Compile time is when the compiler translates your source code to an executable class file.
Runtime is when you run the compiled program. Runtime is always after compile time - you first have to compile a program before you can run it.
Many concepts in
Java programming, including names of variables, have to be known at compile time. What you are trying to do in the code you posted is create a variable name at
runtime. That is not possible, because the variable name has to be known at compile time, which is before runtime.
If you want to create and store objects dynamically, you'll have to store them in a collection such as a List, Map or Set. Have a look at the
Collections tutorial from Oracle to learn about collections.