nuovi test
This commit is contained in:
25
src/com/oracle/java8/associate/ElectricCar.java
Normal file
25
src/com/oracle/java8/associate/ElectricCar.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package com.oracle.java8.associate;
|
||||
|
||||
class Automobile {
|
||||
private final String drive() {
|
||||
return "Driving vehicle";
|
||||
}
|
||||
}
|
||||
|
||||
class Car extends Automobile {
|
||||
protected String drive() {
|
||||
return "Driving car";
|
||||
}
|
||||
}
|
||||
|
||||
public class ElectricCar extends Car {
|
||||
@Override
|
||||
public final String drive() {
|
||||
return "Driving electric car";
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
final Car car = new ElectricCar();
|
||||
System.out.println(car.drive());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user