[Let's learn something new] Explicit constructor invocation

JavaShortSeries

5 December, 2023

52

52

0

  • I learnt something new today and will be sharing it w everyone.
  • We might have seen general uses of this keyword to set the field values of object that is being called, but today we're about to see something interesting, the usage of this keyword to call a constructor within another constructor.
  • This is called explicit constructor invocation
  • In this example, the constructor with no arguments calls the constructor with four arguments and thereby setting those fields with the given values.

image.png

52

52

0

More Articles

Showwcase is a professional tech network with over 0 users from over 150 countries. We assist tech professionals in showcasing their unique skills through dedicated profiles and connect them with top global companies for career opportunities.

© Copyright 2025. Showcase Creators Inc. All rights reserved.