• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

Statement in JLS, clarifications  RSS feed

 
Ranch Hand
Posts: 130
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
About the default constructor the JLS says "If the class being declared is the primordial class Object, then the default constructor has an empty body.

What does the statement "primordial class Object" mean?
 
Master Rancher
Posts: 3676
40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Object is the base class of all classes in Java.
Hence primordial.
The relevant definition (pulled from Google):
"basic and fundamental"
 
Prathima gaitonde
Ranch Hand
Posts: 130
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Dave, Can you please explain me how to achieve this? I mean an example where in we have default constructor with an empty body.
 
Sheriff
Posts: 23714
50
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The definition you quoted is about the java.lang.Object class. I'm not sure what it is that you want to achieve.
 
Prathima gaitonde
Ranch Hand
Posts: 130
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to declare the class being primordial class object.
 
Paul Clapham
Sheriff
Posts: 23714
50
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't, because java.lang.Object already exists.

The purpose of the paragraph you read is to provide an exception for the rule "Every constructor of a class must call (in some way) a constructor of its superclass". Since Object doesn't have a superclass, this rule can't apply to it. And you can't create other classes which don't have a superclass.
 
Prathima gaitonde
Ranch Hand
Posts: 130
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank, now answer to my query is clear.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!