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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:49:05+00:00 2026-05-27T16:49:05+00:00

I was just discussing with some colleagues about Java constructors, design-patterns and good way

  • 0

I was just discussing with some colleagues about Java constructors, design-patterns and good way to initialize objects with a unparametrized constructor if I normally await some parameters.

One of the older ones came up with his way of implementing always something like:

public class Foo {

public Foo() {
this(0,0,0);
}

public Foo(int a, int b, int c) {
this.a = a;
this.b = b;
this.c = c;
}
..
}

My question is, is that good style and what is its behaviour exactly?

From what I understand should be:

  • it instantiates first an Object and then calling the parametrized constructor to construct a new object of that type with that parameter settings and set its own reference to the new one. So the GC has then to delete the first created one.
  • 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-27T16:49:06+00:00Added an answer on May 27, 2026 at 4:49 pm
    So the GC has then to delete the first created one.
    

    No. Only 1 instance is ever created when chaining constructors.

    To answer your question, yes, it’s good style, assuming you need both foo() and foo(int, int, int)

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

Sidebar

Related Questions

I just had a discussion today with some coworkers about python's db-api fetchone vs
Having a design discussion with some co-workers about our app. Looking for the best
I've just heard the term covered index in some database discussion - what does
Just had a discussion at work about the merits of using PostgreSQL over MySQL
I just read a few threads on the discussion of singleton design in javascript.
I'm working on a project which is just about to start, and since I
I'm looking for some help on my discussion. We're discussing two solutions to a
I just came out of a design meeting and had a question posed to
I was looking at some code and discussing it with co-workers. Specifically a section
I was just reading a thread on SO that was discussing the merits of

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.