JAVA What does the following statement do ClassforName javal
JAVA
What does the following statement do? Class.forName (\"java.lang.String\")
Will it cause an error?
Solution
Answer: No. It will not cause an error.
Because we can create an object by using below
1. by new operator
2. by cloning
3.by Class.forName
4. by Deserialization
in Our case, if we write Class.forName (\"java.lang.String\").newInstance() it equals to new String();
