Two interface having same signature default method causing to override them.

Transcribed from the original LinkedIn image post.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;

interface FileUploadExternalDevice {
    default void upload(File file, String path) throws IOException {
        Files.move(file.toPath(), Paths.get(path));
    }
}

interface FileUploadAPIEndpoint {
    default void upload(File file, String path) throws IOException {
        MultipartFile multiPartFile = multiPart(file);
        fileUploadService.storeFile(multiPartFile);
    }
}

class Day015 implements FileUploadExternalDevice, FileUploadAPIEndpoint {

    @Override
    public void upload(File file, String path) throws IOException {
        /*
        implementation
        or
        FileUploadExternalDevice.super.upload(file, path);
        or
        FileUploadAPIEndpoint.super.upload(file, path);
        */
    }
}

The original LinkedIn graphic is preserved below.

Day 16 LinkedIn post