Mittwoch lesson
This commit is contained in:
parent
e0efeb82ef
commit
8901dea11b
61 changed files with 663 additions and 0 deletions
7
Code/Steiner/Zootest/.vscode/settings.json
vendored
Normal file
7
Code/Steiner/Zootest/.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"java.project.sourcePaths": ["src"],
|
||||
"java.project.outputPath": "bin",
|
||||
"java.project.referencedLibraries": [
|
||||
"lib/**/*.jar"
|
||||
]
|
||||
}
|
18
Code/Steiner/Zootest/README.md
Normal file
18
Code/Steiner/Zootest/README.md
Normal file
|
@ -0,0 +1,18 @@
|
|||
## Getting Started
|
||||
|
||||
Welcome to the VS Code Java world. Here is a guideline to help you get started to write Java code in Visual Studio Code.
|
||||
|
||||
## Folder Structure
|
||||
|
||||
The workspace contains two folders by default, where:
|
||||
|
||||
- `src`: the folder to maintain sources
|
||||
- `lib`: the folder to maintain dependencies
|
||||
|
||||
Meanwhile, the compiled output files will be generated in the `bin` folder by default.
|
||||
|
||||
> If you want to customize the folder structure, open `.vscode/settings.json` and update the related settings there.
|
||||
|
||||
## Dependency Management
|
||||
|
||||
The `JAVA PROJECTS` view allows you to manage your dependencies. More details can be found [here](https://github.com/microsoft/vscode-java-dependency#manage-dependencies).
|
BIN
Code/Steiner/Zootest/bin/Animal.class
Normal file
BIN
Code/Steiner/Zootest/bin/Animal.class
Normal file
Binary file not shown.
BIN
Code/Steiner/Zootest/bin/Camel.class
Normal file
BIN
Code/Steiner/Zootest/bin/Camel.class
Normal file
Binary file not shown.
BIN
Code/Steiner/Zootest/bin/Climbing.class
Normal file
BIN
Code/Steiner/Zootest/bin/Climbing.class
Normal file
Binary file not shown.
BIN
Code/Steiner/Zootest/bin/Eagle.class
Normal file
BIN
Code/Steiner/Zootest/bin/Eagle.class
Normal file
Binary file not shown.
BIN
Code/Steiner/Zootest/bin/Flying.class
Normal file
BIN
Code/Steiner/Zootest/bin/Flying.class
Normal file
Binary file not shown.
BIN
Code/Steiner/Zootest/bin/Frog.class
Normal file
BIN
Code/Steiner/Zootest/bin/Frog.class
Normal file
Binary file not shown.
BIN
Code/Steiner/Zootest/bin/Swimming.class
Normal file
BIN
Code/Steiner/Zootest/bin/Swimming.class
Normal file
Binary file not shown.
BIN
Code/Steiner/Zootest/bin/ZooTest.class
Normal file
BIN
Code/Steiner/Zootest/bin/ZooTest.class
Normal file
Binary file not shown.
3
Code/Steiner/Zootest/src/Animal.java
Normal file
3
Code/Steiner/Zootest/src/Animal.java
Normal file
|
@ -0,0 +1,3 @@
|
|||
public abstract class Animal {
|
||||
public abstract void makeSound();
|
||||
}
|
11
Code/Steiner/Zootest/src/Camel.java
Normal file
11
Code/Steiner/Zootest/src/Camel.java
Normal file
|
@ -0,0 +1,11 @@
|
|||
public class Camel extends Animal implements Climbing {
|
||||
@Override
|
||||
public void makeSound() {
|
||||
System.out.println("Desert Camel grumbles!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void climb() {
|
||||
System.out.println("Desert Camel climbs a dune.");
|
||||
}
|
||||
}
|
3
Code/Steiner/Zootest/src/Climbing.java
Normal file
3
Code/Steiner/Zootest/src/Climbing.java
Normal file
|
@ -0,0 +1,3 @@
|
|||
public interface Climbing {
|
||||
void climb();
|
||||
}
|
16
Code/Steiner/Zootest/src/Eagle.java
Normal file
16
Code/Steiner/Zootest/src/Eagle.java
Normal file
|
@ -0,0 +1,16 @@
|
|||
public class Eagle extends Animal implements Flying, Swimming {
|
||||
@Override
|
||||
public void makeSound() {
|
||||
System.out.println("Eagle screams!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fly() {
|
||||
System.out.println("Eagle flies high in the sky.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void swim() {
|
||||
System.out.println("Eagle fishes in the water (swims...).");
|
||||
}
|
||||
}
|
4
Code/Steiner/Zootest/src/Flying.java
Normal file
4
Code/Steiner/Zootest/src/Flying.java
Normal file
|
@ -0,0 +1,4 @@
|
|||
public interface Flying {
|
||||
void fly();
|
||||
}
|
||||
|
16
Code/Steiner/Zootest/src/Frog.java
Normal file
16
Code/Steiner/Zootest/src/Frog.java
Normal file
|
@ -0,0 +1,16 @@
|
|||
public class Frog extends Animal implements Swimming, Climbing {
|
||||
@Override
|
||||
public void makeSound() {
|
||||
System.out.println("Green Frog croaks!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void swim() {
|
||||
System.out.println("Green Frog swims in the pond.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void climb() {
|
||||
System.out.println("Green Frog climbs a tree.");
|
||||
}
|
||||
}
|
3
Code/Steiner/Zootest/src/Swimming.java
Normal file
3
Code/Steiner/Zootest/src/Swimming.java
Normal file
|
@ -0,0 +1,3 @@
|
|||
public interface Swimming {
|
||||
void swim();
|
||||
}
|
17
Code/Steiner/Zootest/src/ZooTest.java
Normal file
17
Code/Steiner/Zootest/src/ZooTest.java
Normal file
|
@ -0,0 +1,17 @@
|
|||
public class ZooTest {
|
||||
public static void main(String[] args) {
|
||||
Animal eagle = new Eagle();
|
||||
eagle.makeSound();
|
||||
((Eagle) eagle).fly();
|
||||
((Eagle) eagle).swim();
|
||||
|
||||
Animal frog = new Frog();
|
||||
frog.makeSound();
|
||||
((Frog) frog).swim();
|
||||
((Frog) frog).climb();
|
||||
|
||||
Animal camel = new Camel();
|
||||
camel.makeSound();
|
||||
((Camel) camel).climb();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue