Skip to content

Instantly share code, notes, and snippets.

@sreeprasad
Created November 22, 2014 12:07
Show Gist options
  • Select an option

  • Save sreeprasad/7a6a56717ef94fc70c21 to your computer and use it in GitHub Desktop.

Select an option

Save sreeprasad/7a6a56717ef94fc70c21 to your computer and use it in GitHub Desktop.
Any method reference of a method that takes no parameters and returns void of a class can be used as code for Thread
public class ExampleTwo {
public static void myExample(){
System.out.println("Hello there, you have reached personal website of Sreeprasad");
}
public static void main(String[] args) {
Thread t = new Thread(ExampleTwo::myExample);
t.start();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment