As I know ,constructor should not have a return value but if I try the above code in eclipse it does not throw any error ,
A a=new ();
your understanding of constructor is little wrong.as above said,it is a regular method.
But yes you are right i have read somewhere that constructor return some value to an operating system but that is of no use for us.So in java terms there is no value return by constructor.
rahul S Sharma wrote:The default return type of a constructor is the object of the same class. You cannot make a constructor explicitly return any other data type.
That's not really true. Constructors do not return anything, and constructors don't have a return type.
A constructor is a special block of code that is called to initialize a new object. The constructor is not what creates the object - it just initializes the object, the new operator is what actually creates the object and calls the constructor to initialize it.
The thing that makes this confusing is that it is possible to have regular methods that have the same name as the class. Such a method can easily be mistaken to be a constructor.