Skip to content

Commit c1caca5

Browse files
committed
What Is an Interface?
1 parent 447d91d commit c1caca5

File tree

10 files changed

+101
-66
lines changed

10 files changed

+101
-66
lines changed

Bicycle/.classpath

-7
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,6 @@
66
<attribute name="maven.pomderived" value="true"/>
77
</attributes>
88
</classpathentry>
9-
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
10-
<attributes>
11-
<attribute name="optional" value="true"/>
12-
<attribute name="maven.pomderived" value="true"/>
13-
<attribute name="test" value="true"/>
14-
</attributes>
15-
</classpathentry>
169
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
1710
<attributes>
1811
<attribute name="maven.pomderived" value="true"/>
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
eclipse.preferences.version=1
22
encoding//src/main/java=UTF-8
3-
encoding//src/test/java=UTF-8
43
encoding/<project>=UTF-8

Bicycle/src/test/java/br/net/ti2/AppTest.java

-20
This file was deleted.

WhatIsAnInterface/.factorypath

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<factorypath>
2+
<factorypathentry kind="VARJAR" id="M2_REPO/org/projectlombok/lombok/1.18.8/lombok-1.18.8.jar" enabled="true" runInBatchMode="false"/>
3+
</factorypath>

WhatIsAnInterface/pom.xml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<groupId>docs.oracle.com.javase.tutorial.java.concepts.interface_</groupId>
6+
<artifactId>WhatIsAnInterface</artifactId>
7+
<version>0.0.1</version>
8+
<packaging>jar</packaging>
9+
10+
<name>WhatIsAnInterface</name>
11+
<url>http://maven.apache.org</url>
12+
13+
<properties>
14+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15+
</properties>
16+
17+
<dependencies>
18+
<dependency>
19+
<groupId>junit</groupId>
20+
<artifactId>junit</artifactId>
21+
<version>3.8.1</version>
22+
<scope>test</scope>
23+
</dependency>
24+
<dependency>
25+
<groupId>org.projectlombok</groupId>
26+
<artifactId>lombok</artifactId>
27+
<version>1.18.8</version>
28+
<scope>provided</scope>
29+
</dependency>
30+
</dependencies>
31+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package docs.oracle.com.javase.tutorial.java.concepts.interface_.WhatIsAnInterface;
2+
3+
import lombok.AllArgsConstructor;
4+
import lombok.Data;
5+
import lombok.Setter;
6+
import lombok.ToString;
7+
8+
@Setter
9+
@ToString
10+
@AllArgsConstructor
11+
public @Data class ACMEBicycle implements Bicycle {
12+
13+
int cadence = 0;
14+
int speed = 0;
15+
int gear = 1;
16+
17+
public void changeCadence(int newCadence){
18+
cadence = newCadence;
19+
}
20+
21+
public void speedUp(int increment) {
22+
speed += increment;
23+
}
24+
25+
public void applyBrakes(int decrement) {
26+
speed -= decrement;
27+
}
28+
29+
public void changeGear(int newGear){
30+
gear = newGear;
31+
}
32+
33+
public void printStates(){
34+
System.out.println(toString());
35+
}
36+
37+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package docs.oracle.com.javase.tutorial.java.concepts.interface_.WhatIsAnInterface;
2+
3+
/**
4+
* Hello world!
5+
*
6+
*/
7+
public class App
8+
{
9+
public static void main( String[] args )
10+
{
11+
Bicycle b = new ACMEBicycle(1,2,3);
12+
b.printStates();
13+
}
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package docs.oracle.com.javase.tutorial.java.concepts.interface_.WhatIsAnInterface;
2+
3+
interface Bicycle {
4+
void changeCadence(int newValue);
5+
6+
void changeGear(int newValue);
7+
8+
void speedUp(int increment);
9+
10+
void applyBrakes(int decrement);
11+
12+
void printStates();
13+
}

WhatIsInheritance/.factorypath

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<factorypath>
2+
<factorypathentry kind="VARJAR" id="M2_REPO/org/projectlombok/lombok/1.18.8/lombok-1.18.8.jar" enabled="true" runInBatchMode="false"/>
3+
</factorypath>

WhatIsInheritance/src/test/java/docs/oracle/com/javase/tutorial/java/concepts/inheritance/WhatIsInheritance/AppTest.java

-38
This file was deleted.

0 commit comments

Comments
 (0)