diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..e4e3d55 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +Vehicle.java \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..0d37eff --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,61 @@ + + + + + + + + + + { + "associatedIndex": 5 +} + + + + { + "keyToString": { + "ModuleVcsDetector.initialDetectionPerformed": "true", + "RunOnceActivity.ShowReadmeOnStart": "true", + "RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager.252": "true", + "RunOnceActivity.git.unshallow": "true", + "RunOnceActivity.typescript.service.memoryLimit.init": "true", + "git-widget-placeholder": "main", + "kotlin-language-version-configured": "true", + "last_opened_file_path": "D:/java/untitled2/java", + "settings.editor.selected.configurable": "preferences.language.and.region", + "vue.rearranger.settings.migration": "true" + } +} + + + + + + + + + + 1775042616030 + + + + + + \ No newline at end of file diff --git a/w5/VehicleTest.java b/w5/VehicleTest.java new file mode 100644 index 0000000..97c3c49 --- /dev/null +++ b/w5/VehicleTest.java @@ -0,0 +1,29 @@ +abstract class Vehicle { + public abstract void run(); +} +class Car extends Vehicle { + @Override + public void run() { + System.out.println("汽车在公路上行驶"); + } +} +class Bike extends Vehicle { + @Override + public void run() { + System.out.println("自行车在非机动车道行驶"); + } +} +class Truck extends Vehicle { + @Override + public void run() { + System.out.println("卡车在货运道路行驶"); + } +} +public class VehicleTest { + public static void main (String[] args) { + Vehicle[] vehicles = {new Car(),new Bike(),new Truck()}; + for (Vehicle v : vehicles) { + v.run(); + } + } +} \ No newline at end of file diff --git a/w5/运行截图.png b/w5/运行截图.png new file mode 100644 index 0000000..ea69d5f Binary files /dev/null and b/w5/运行截图.png differ