Originally posted by Tony Smith:
"All classes have at least one constructor. If a class does not explicitly declare any, the Java compiler automatically provides a no-argument constructor, called the default constructor. This default constructor calls the class parent's no-argument constructor, or the Object constructor if the class has no other parent. If the parent has no constructor (Object does have one), the compiler will reject the program."
When would it happen when the parent class has no constructor and the class is not associated with Object class?
Originally posted by Tony Smith:
I think B is also an object, by definition all object has default constructor. Check out my following test code, it run just fine...
}
Originally posted by Tony Smith:
"... If the parent has no constructor (Object does have one), the compiler will reject the program." ...
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Originally posted by Maneesh Godbole:
Doesnt everything in Java extend the Object implicitly? (pure OO language).
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Originally posted by Maneesh Godbole:
What I meant was, since every class extends the Object class, eventually the default "Object" constructor would be used.
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Originally posted by Tony Smith:
I think B is also an object, by definition all object has default constructor.
Joanne
Originally posted by marc weber:
However, this does not make it a "pure OO language" (which is a term that needs to be defined before using it to describe anything).
Thanks
Joanne
Originally posted by Maneesh Godbole:
Oh!
I was under the impression that "pure OO" means everything is an object. I have read the typical comparisson between C++ and Java. You can write non OO code in C++ but cant in Java.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |