Browse Source

202506050218

main
wangminjun 2 weeks ago
parent
commit
548f7a18ca
  1. 0
      w5/AI协助记录.txt
  2. 38
      w5/Shapetest.java
  3. BIN
      w5/程序运行截图.png

0
w5/AI协助记录.txt

38
w5/Shapetest.java

@ -0,0 +1,38 @@
package com.example.shape;
class Shape {
public void draw() {
System.out.println("绘制形状");
}
}
class Circle extends Shape {
@Override
public void draw() {
System.out.println("绘制圆形");
}
}
class Rectangle extends Shape {
@Override
public void draw() {
System.out.println("绘制矩形");
}
}
public class Shapetest {
public static void drawShape(Shape s) {
s.draw();
}
public static void main(String[] args) {
Shape circle = new Circle();
drawShape(circle);
Shape rectangle = new Rectangle();
drawShape(rectangle);
Shape general = new Shape();
drawShape(general);
}
}

BIN
w5/程序运行截图.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

Loading…
Cancel
Save