5 changed files with 97 additions and 0 deletions
@ -0,0 +1 @@ |
|||
Vehicle.java |
|||
@ -0,0 +1,6 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project version="4"> |
|||
<component name="VcsDirectoryMappings"> |
|||
<mapping directory="" vcs="Git" /> |
|||
</component> |
|||
</project> |
|||
@ -0,0 +1,61 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project version="4"> |
|||
<component name="ChangeListManager"> |
|||
<list default="true" id="8e3e51eb-8beb-4b33-b423-c0d05e3bc0cd" name="Changes" comment=""> |
|||
<change afterPath="$PROJECT_DIR$/w5/VehicleTest.java" afterDir="false" /> |
|||
</list> |
|||
<option name="SHOW_DIALOG" value="false" /> |
|||
<option name="HIGHLIGHT_CONFLICTS" value="true" /> |
|||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> |
|||
<option name="LAST_RESOLUTION" value="IGNORE" /> |
|||
</component> |
|||
<component name="Git.Settings"> |
|||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> |
|||
</component> |
|||
<component name="ProjectColorInfo">{ |
|||
"associatedIndex": 5 |
|||
}</component> |
|||
<component name="ProjectId" id="3Bkoq0Kwl66wS2xPmDc9y2mPKXI" /> |
|||
<component name="ProjectViewState"> |
|||
<option name="hideEmptyMiddlePackages" value="true" /> |
|||
<option name="showLibraryContents" value="true" /> |
|||
</component> |
|||
<component name="PropertiesComponent">{ |
|||
"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" |
|||
} |
|||
}</component> |
|||
<component name="SharedIndexes"> |
|||
<attachedChunks> |
|||
<set> |
|||
<option value="bundled-jdk-30f59d01ecdd-2fc7cc6b9a17-intellij.indexing.shared.core-IU-253.31033.145" /> |
|||
<option value="bundled-js-predefined-d6986cc7102b-9b0f141eb926-JavaScript-IU-253.31033.145" /> |
|||
</set> |
|||
</attachedChunks> |
|||
</component> |
|||
<component name="TaskManager"> |
|||
<task active="true" id="Default" summary="Default task"> |
|||
<changelist id="8e3e51eb-8beb-4b33-b423-c0d05e3bc0cd" name="Changes" comment="" /> |
|||
<created>1775042616030</created> |
|||
<option name="number" value="Default" /> |
|||
<option name="presentableId" value="Default" /> |
|||
<updated>1775042616030</updated> |
|||
<workItem from="1775042617092" duration="882000" /> |
|||
<workItem from="1775104128296" duration="4129000" /> |
|||
<workItem from="1775653218714" duration="2004000" /> |
|||
</task> |
|||
<servers /> |
|||
</component> |
|||
<component name="TypeScriptGeneratedFilesManager"> |
|||
<option name="version" value="3" /> |
|||
</component> |
|||
</project> |
|||
@ -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(); |
|||
} |
|||
} |
|||
} |
|||
|
After Width: | Height: | Size: 248 KiB |
Loading…
Reference in new issue