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 8313099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T20:22:54+00:00 2026-06-08T20:22:54+00:00

when we synchronize some static method lock is acquired on class.class so what does

  • 0

when we synchronize some static method lock is acquired on class.class
so what does class.class represents, by googling and reading through some forums i came to know its instance of java.lang.Class and for all the classes in memory there exists one instance of java.lang.Class associated with them. is it??

One can create object of that class with this and acquire lock on this, apart from that what all major functionalities does it offer which are useful in my regular java application??

any reference link is welcomed. Thanks!!

  • 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-08T20:22:56+00:00Added an answer on June 8, 2026 at 8:22 pm

    …its instance of java.lang.Class and for all the classes in memory there exists one instance of java.lang.Class associated with them.

    Basically, yes, although I think it’s one copy per classloader rather than in total. But as you normally have only one classloader…

    The Class instance represents the class as a whole, as distinct from other classes, just as instances of classes are distinct from all other instances of that class. So since static methods are specific to the class (just like non-static methods are specific to the instance), it makes sense to synchronize on the class instance when calling a static method (if the method requires synchronization). Which is why that’s what the JLS says happens if you apply the synchronized keyword to the method as a whole.

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

Sidebar

Related Questions

My singleton accessor method is usually some variant of: static MyClass *gInstance = NULL;
I am java and php programmer. In java i can use static class/method so
How to synchronize two different methods from the same class in order to lock
I have a Static helper class implemented that helps cache and retreive some read-only,
Consider the following static method: public void static foo() { // some heavy operation
When I'm testing this static method public class SomeClass { public static long someMethod(Map
I was wondering if synchronize (lock) { ... } Where lock is an instance
Consider the following code :- public class UsingWait1{ public static void main(String... aaa){ CalculateSeries
I have a class in a highly concurrent system. A method getResolvedClassName() of that
I am just working through some examples from my text book, writing the 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.