[Java] Lambda expressions

1. Why use Lambda?

Example:

Requirement: Execute a piece of logic by starting a new thread.

public class TestLambda implements Runnable {
	
	public void run() {
		System.out.println("DoSomething.....");
	}
	
	public static void main(String[] args) {
		TestLambda testLambda = new TestLambda ();
		//Start a new thread to execute the logic
		new Thread(testLambda).start();
	}

}

  

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324864527&siteId=291194637