Shapes combination in Java?

前端 未结 2 1992
面向向阳花
面向向阳花 2021-01-23 16:01

Does java Shape interface contract and library routines allow combining multiple shapes into one object extending Shape interface?

For example,

2条回答
  •  伪装坚强ぢ
    2021-01-23 16:19

    To manipulate shapes in Java like you're describing, you want to use the Area class, which has these operations. Just convert a Shape to an Area with new Area(Shape).

提交回复
热议问题