Switch to full style
Java2 codes,problems ,discussions and solutions are here
Post a reply

Object without new Operator

Wed Oct 22, 2008 2:12 am

How to create a object of a final class without using new operator ?



Re: Object without new Operator

Wed Oct 22, 2008 2:13 am

yes , but you will have to casting . example :

Code:
String objStr = (String)Class.forName("java.lang.String").newInstance( );


as it returns a general object.

Post a reply
  Related Posts  to : Object without new Operator
 Using the ? Operator     -  
 operator int()     -  
 What is the % operator     -  
 trinary operator     -  
 stream operator     -  
 operator overloading     -  
 What is Operator Overloading? !!!     -  
 Sizeof Operator     -  
 unary operator overloading     -  
 working of bitwise ~ operator     -  

Topic Tags

Java OOP