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

  • SEARCH
  • Home
  • 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 7573561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:12:48+00:00 2026-05-30T16:12:48+00:00

Just a bit of idle curiosity here. Basically, if I have an object that

  • 0

Just a bit of idle curiosity here.

Basically, if I have an object that only has a few primitive data members, it takes up a small amount of memory and doesn’t take very long at all to create. However, what happens if I have a lot of methods associated with that object? Does object instantiation have to take those into account at all?

For example, let’s say I have a Class with (insert absurdly large number here) number of distinct methods I can call. Does the JVM take any longer to make an instance of that class than if I had no methods?

  • 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-05-30T16:12:50+00:00Added an answer on May 30, 2026 at 4:12 pm

    No, Class with methods is stored once in a separate memory location (namely PermGen) and each object of a given class has only a single reference to its type (Class).

    Thus it doesn’t matter how many methods your object has: two or two thousand – the object creation will take exactly the same amount of time.

    BTW the same holds true for method invocation – there is no performance hit when calling methods of an object having plenty of them compared to object having only few.

    See also

    • What's the method representation in memory?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am just a bit curious about the new function std::move() that has just
I have windows 7 (64-bit) and just upgraded IE9 in my machine. I did
So, I was just coding a bit today, and I realized that I don't
Just need a little bit of Javascript to warn people that press the back
I'm just needing a simple bit of code for vb.net that will allow me
Just a bit rusty on the old linq. If I have 2 collections EG
I was just a bit bored and was thinking that it would be cool
I'm just a bit CSSing, and I have this code: #page { width: 950px;
Just a bit of background first. I currently have a site hosted with Windows
On OSX, I have a Python universal binary which just contains 32-bit code: $

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.