Skip to content

Instantly share code, notes, and snippets.

@juliofalbo
Created October 11, 2019 19:34
Show Gist options
  • Save juliofalbo/5517db906a7d3b12cbc76048c549e398 to your computer and use it in GitHub Desktop.
Save juliofalbo/5517db906a7d3b12cbc76048c549e398 to your computer and use it in GitHub Desktop.
public class StaticMethods {
public static void main(String[] args) {
InterfaceWithStaticMethod impl1 = (text) -> System.out.println("Custom Message " + text);
impl1.printWithCustomMessage("Text");
InterfaceWithStaticMethod.print("Text");
}
}
interface InterfaceWithStaticMethod {
void printWithCustomMessage(String text);
static void print(String text) {
System.out.println(text);
}
}
interface RunnableInterface {
public static void main(String[] args) {
System.out.println("Ran by an Interface");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment