Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

Can we mark a constructor as synchronized in Java?

Pragya Keshap answered on February 4, 2023 Popularity 3/10 Helpfulness 4/10

Contents


More Related Answers

  • java normal constructor
  • type of constructor in java
  • synchronized java
  • synchronized block java
  • java call another constructor
  • how to create a constructor in java
  • what is constructor in java
  • Java Synchronized Method
  • Synchronized Block in Java
  • syntax of a constructor in java
  • can a java class have more than 108 constructors
  • calling this in constructor java
  • Constructors in Java
  • what is constructor in java
  • java two constructors
  • java constructor example
  • different constructiors in java and what they do explained
  • Synchronized Method in Java
  • Can we use synchronized block for primitives?
  • Using synchronized keyword
  • constructors java
  • Calling constructor methods in java

  • Can we mark a constructor as synchronized in Java?

    0

    No. We cannot mark a constructor as synchronized.

    This will lead to compiler error.

    The reasoning behind this is that, in this case, only the constructing

    thread would have access to the object being constructed

    https://www.tutorialspoint.com/can-a-constructor-be-synchronized-in-java

    Popularity 3/10 Helpfulness 4/10 Language java
    Source: Grepper
    Link to this answer
    Share Copy Link
    Contributed on Feb 04 2023
    Pragya Keshap
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.