1

If I take a user inputted String in my program which contains the Object Type that I am trying to create, is there a way for me to create an instance of that object? Something like the below:

Scanner sc = new Scanner(System.in);
System.out.print("Enter an Object Type: ");  
String str = sc.nextLine();
// for example user inputs "Integer"
// I now want to create an Integer Object
qwerty2
  • 13
  • 2

0 Answers0