1030自主学習

This commit is contained in:
2026-10-30 17:49:49 +09:00
parent d9529e2971
commit c0101fc96d
186 changed files with 2507 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21"/>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>

1
Question14-Interface/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/build/

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Question14-Interface</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@@ -0,0 +1,9 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=21
org.eclipse.jdt.core.compiler.compliance=21
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=21

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<installed facet="java" version="21"/>
</faceted-project>

View File

@@ -0,0 +1,6 @@
import java.util.List;
public interface Book {
String title();
List <String> chapter();
}

View File

@@ -0,0 +1,21 @@
import java.util.ArrayList;
import java.util.List;
public class Book1_programming implements Book{
public String title() {
return "プログラミング基礎入門";
}
public List <String> chapter(){
List <String> chapter = new ArrayList<String>();
chapter.add("式と変数");
chapter.add("制御構文");
chapter.add("メソッド");
chapter.add("オブジェクト指向");
chapter.add("継承");
return chapter;
}
}

View File

@@ -0,0 +1,5 @@
public interface Car {
void refill(int amount);
void run(int speed);
}

View File

@@ -0,0 +1,11 @@
public class Question14_1 {
public static void main(String[] args) {
// TODO 自動生成されたメソッド・スタブ
Book1_programming book = new Book1_programming();
System.out.println(book.title());
System.out.println(book.chapter());
}
}

View File

@@ -0,0 +1,11 @@
public class Question14_2 {
public static void main(String[] args) {
// TODO 自動生成されたメソッド・スタブ
sportCar car = new sportCar();
car.refill(100);
car.run(100);
car.run(301);
}
}

View File

@@ -0,0 +1,14 @@
public class sportCar implements Car{
public void refill(int num) {
System.out.println("ハイオクを" + num + "リットル補充した");
}
public void run(int speed) {
if(speed > 300) {
System.out.println("速度オーバーです");
}else {
System.out.println("スポーツカーは時速" + speed + "キロで走った");
}
}
}