Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8786101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:31:51+00:00 2026-06-13T21:31:51+00:00

I see Java has only one metaclass (the Class class), but other languages, say

  • 0

I see Java has only one metaclass (the Class class), but other languages, say Smalltalk, have one metaclass for each Class.

Why is that? What’s the need for metaclasses? What difference does it make to have them one way or another?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T21:31:53+00:00Added an answer on June 13, 2026 at 9:31 pm

    The fundamental need for at least one metaclass is that if you want objects that represent classes (or want classes to be objects), then those objects must have a type.

    Wikipedia says:

    In early Smalltalks, there was only one metaclass called Class. This
    implied that the methods all classes have were the same, in particular
    the method to create new objects, i.e., new. To allow classes to have
    their own methods and their own instance variables (called class
    instance variables and should not be confused with class variables),
    Smalltalk-80 introduced for each class C their own metaclass C class.

    So the question is, do you want every class object to have the same type (and hence the same members), or do you want class objects to differ in ways that require them to have different types, so that there are type-checked operations which can be performed on the object that represents class A but not on the object that represents class B? Java and early Smalltalks answered that question differently from later Smalltalks.

    So for example java.lang.Class.newInstance() takes no constructor arguments, whereas you can imagine that it might be nice to be able to call clz.newInstance(1) where clz is the class object for a class that has a constructor with takes an int. In Java you can still look through the constructors of the class yourself to find a match for the arguments you want to pass, but the type of the class object doesn’t tell you whether you will find one.

    Also note that Smalltalk stops at one level. The type of C is C class, but the type of C class is Metaclass. There’s no infinite recursion of types C class class etc, because although different class objects in Smalltalk accept different messages, there’s no demand for different metaclass objects to accept different messages.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does such a thing exist anywhere? Basically I see java has LinkedHashSet but no
I have been writing a small java application (my first!), that does only a
I have Epic Editor which returns a handle to the window (see Java code
I see many Java packages have api, impl and bundle jars (name-api.jar, name-impl.jar, name-bundle.jar).
I could see bunch of java parsers like OpenCSV, antlr, jsapar etc, but I
I am having problems having my Java programs see classes that are packaged in
I have successfully created an object loader in java that loads in vertices, indices,
I have a Java client that consumes SharePoint 2010 standard web services (sitedata.asmx, permissions.asmx,
I have an entity in my app engine datastore. There's actually only one instance
I have an android application (written in java) which has two buttons ( connect

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.