Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@kunals201
Created March 9, 2018 07:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kunals201/e5c5ef57df136cb84f347cdf3dfb1c61 to your computer and use it in GitHub Desktop.
Save kunals201/e5c5ef57df136cb84f347cdf3dfb1c61 to your computer and use it in GitHub Desktop.
Java9 interface private methods example
interface Util {
default int numberOfStudents() {
return helper();
}
private int helper() {
return 10;
}
static int getCores() {
return helper1();
}
private static int helper1() {
return 2;
}
}
public class Sample {
public static void main(String[] args) {
System.out.println("OK");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment