hi there,I really appreciates ur question...so well i am also not a very old java guru,, but i am sure it wont make any abnormal effects on object initializtion... it will work just the same way as it works when the Constructor was declared public... do me a favour when u get an answer ( a solid one) do mail it to me: Name: Azam Bukhari Email: email@example.com
Originally posted by amrit singh: hi!!! all i am new to JAVA pls anybody throw a light on this... how object initialization is effected when we declare constructors to be private or public.
The only thing that is affected is the access to the constructor function. Private constructors can only be called within the same class. Meaning that a new object cannot be initialized if it is done outside of the class in which the constructor is declared. However a public constructor can be called from any location. Private constructors are predominantly used when programmers want to put constraints on the creation instantiation of objects. Hope that helps!