Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please write a Java program which asks the user in terminal, examples are below) to provide a name of a Java class, and then creates
Please write a Java program which asks the user in terminal, examples are below) to provide a name of a Java class, and then creates an instance of that class with the default constructor (hint: see the examples in the lecture about The Reflection API) and performs some operations on that object as explained below, using exceptions to deal with all problematic situations so that the program never fails but asks for better input instead. 1. 1 pts After starting, the program asks for a name of Java class, and confirms that it will use that name in the next step, e.g. $ java Main Enter class name: Abc OK, instance of class 'Abc will be created. 2. 2 pts If no such class is available, the program asks for other name, e.g. $ java Main Enter class name: Abc OK, instance of class 'Abc' will be created. Sorry, I don't know this class. Enter class name: 3. 2 pts If the class is available, an instance of that class is created, and the object is printed (simply based on its toString() method), e.g. for a class which does not override toString() it may look similar to: Enter class name: A OK, instance of class 'A' will be created. The created object: A@251a69d7
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started