How to add a new alternative constructor in Java?

Viewed 52

Below is a Circle class in python,

class Circle(object):

   def __init__(self, radius):
      self.radius = radius

that gets redesigned as shown below, based on customer requirement change,

class Circle(object):

   def __init__(self, radius):
      self.radius = radius

   @classmethod                # Alternative constructor  
   def from_bbd(cls, bbd):     # Bounding box diagnol
      radius = bbd / 2.0 / math.sqrt(2.0)
      return cls(radius)

Circle class provide a contract to get sub-classed.

In class design life-cycle, What is Java's approach in adding a new alternative constructor, in above scenario?

1 Answers
Related