Home > Back-end >  Jane a Java topics for answer, thank you
Jane a Java topics for answer, thank you

Time:10-03

Create a Shape (Shape), for this class encapsulates the necessary member attributes, and for the class getPerimeter () method, is used to get the perimeter of the Shape, create two subclasses of Shape class Square (Square type) and the Circle (round), for the two subclasses derived from Shape, and rewrite the superclass getPerimeter () method, were used to calculate the perimeter of the Square and round, and require that the parent and child classes are placed in different packages, in the main method of the main class testing and running, (only learned the inheritance and polymorphism, want to use knowledge to solve simple)

CodePudding user response:

A simple way?? Direct return x * y/r * r?
  • Related