Passing Null from the constructor
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   arun_thakur
Posted On:   Wednesday, March 15, 2006 01:00 PM


When we are passing null as arguments from the constructor and returning the object from that constructor.



So vector containing such objects is null itself or not ????

Re: Passing Null from the constructor

Posted By:   WarnerJan_Veldhuis  
Posted On:   Wednesday, March 15, 2006 06:21 PM

A constructor does not return anything. It creates the object. It cannot return null. Assuming you talk about the constructor of Vector, do you want to create a Vector v = new Vector(null)??? That will throw a NPE (NullPointerException)...
About | Sitemap | Contact