Skip to content

Instantly share code, notes, and snippets.

@dg3feiko
Created December 18, 2016 12:47
Show Gist options
  • Save dg3feiko/597cbbee0a1519622354ad7ee88f833c to your computer and use it in GitHub Desktop.
Save dg3feiko/597cbbee0a1519622354ad7ee88f833c to your computer and use it in GitHub Desktop.
package com.company;

public class Main {

    public static void main(String[] args) {
	    SoftwareEngineer a = new SoftwareEngineer();
        ((Employee)a).foo();
    }
}
package com.company;
public interface Employee
{
    default public void foo(){
        System.out.print("Employee");
    }
}
package com.company;
public class SoftwareEngineer implements Employee
{

    @Override
    public void foo()
    {
        System.out.print("SE");
    }
}
@dg3feiko
Copy link
Author

output:

SE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment