I encountered a code where this() method in java takes three parameters two being integers and the third one is boolean value.
what exactly does that mean ? Are there any other variants of this() method ?
Hera is the actual code.
public SegmentConstructor(int seqNum_, int length_) {
this(seqNum_, length_, false);
}
Thank You..
It means that there is another constructor in the current class that has that signature.
The
thismethod is just a way to call one of your class’s constructors from within another constructor, to help avoid code duplication. It can only be called on the first line of a constructor–never from within any other method.