I want to create new object and to give it user input name.
Example user input "robert" wil match to:
Action robert = new Action();
robert.eat();
What do I need to change in the program so I can create a new object with a dynamic name? Many Thanks. I write the next code:
import java.util.Scanner;
public class Human {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner user_input = new Scanner( System.in );
String first_name;
System.out.print("Enter your first name: ");
first_name = user_input.next( );//robert
System.out.println("You are " + first_name);//robert
Action first_name = new Action();
Food orange = new Food();
robert.eat(orange);
}
}