Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Is constructors in JAVA really implicitly "static"?

843789Dec 4 2009 — edited Dec 7 2009
After years of C++ experence, I am finally forced into JAVA world for some trival reasons which I decided not to rebel. So, understandably I chose Bruce Eckel's <thinking in JAVA 4th edition>, a good JAVA book from view of the standing point of a C++er (which,by the way, sours muscles even when you hold it for only a little while.:))

The author has more than once emphasized in that book that the constructors in JAVA is implicitly "static".

I feel so unacceptable. How could a function in which the "this" token could be freely used be "static".

I hope the author dose not mean by constructors the whole process of creating a object, including memory allocations and some other behide-the-scene series of action compelled by compiler. Because if so stated, all other method could be taken as static function call by passing a object reference as the "this" parameter. (which is assumed what compiler dose behind the scene).

To a java language user, a constructor seams to be called out of no object. When we write code
SomeObjClass ref = new SomeObjClass(), it literally looks like we are calling constructor directly.I do not think the autor could be that superfical, but I could not convence myself buying the statement that "constructor is implicitly static" as well.

So is constructors really implicitly static in JAVA? How could I understand this?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 4 2010
Added on Dec 4 2009
109 comments
876 views