demo.java 566 B

12345678910111213141516171819202122232425262728
  1. /*
  2. * @Description:
  3. * @Autor: kindring
  4. * @Date: 2021-09-15 13:53:34
  5. * @LastEditors: kindring
  6. * @LastEditTime: 2021-09-15 13:53:35
  7. * @LastDescript:
  8. */
  9. class Point2 {
  10. protected double x;
  11. protected double y;
  12. Point2(double x, double y) {
  13. this.x = x; this.y = y;
  14. }
  15. public getPos() {
  16. System.out.println(this.x + " " + this.y);
  17. }
  18. }
  19. class Point3 extends Point2{
  20. protected double z;
  21. Point2(double x, double y, double z) {
  22. super(x, y); this.z = z;
  23. }
  24. public getPos() {
  25. System.out.println(this.x + " " + this.y + " " + this.z);
  26. }
  27. }