Search Interview Questions | ![]() ![]() Click here and help us by providing the answer. ![]() Click Correct / Improve and please let us know. |
|
| |||||
Core Java - Interview Questions and Answers for 'Class.forname' - 2 question(s) found - Order By Newest | |||||
![]() | |||||
| |||||
Ans. Using new operator - new xyzClass() Using factory methods - xyzFactory.getInstance( ) Using newInstance( ) method - (Class.forName(xyzClass))emp.newInstance( ) By cloning an already available object - (xyzClass)obj1.clone( ) | |||||
![]() ![]() | |||||
![]() | |||||
![]() ![]() ![]() ![]() ![]() | |||||
![]() | |||||
![]() | |||||
![]() | |||||
![]() | |||||
![]() | |||||
![]() | |||||
![]() | |||||
| |||||
Ans. new operator is used to statically create an instance of object. newInstance() is used to create an object dynamically ( like if the class name needs to be picked from configuration file ). If you know what class needs to be initialized , new is the optimized way of instantiating Class. | |||||
![]() | |||||
![]() ![]() ![]() ![]() | |||||
![]() | |||||
![]() | |||||
![]() or What is the difference between String , StringBuilder and StringBuffer ? | |||||
![]() | |||||
![]() | |||||
![]() | |||||
![]() | |||||
![]() | |||||
![]() | |||||
![]() | |||||
![]() | |||||