diff --git a/core-java-modules/core-java/src/main/java/com/baeldung/anonymousclass/AnonymousClassExample.java b/core-java-modules/core-java/src/main/java/com/baeldung/anonymousclass/AnonymousClassExample.java new file mode 100644 index 0000000000..a58dbf9864 --- /dev/null +++ b/core-java-modules/core-java/src/main/java/com/baeldung/anonymousclass/AnonymousClassExample.java @@ -0,0 +1,13 @@ +package com.baeldung.anonymousclass; + +public class AnonymousClassExample{ + + public static void main(String[] args){ + Thread t1 = new Thread(new Runnable(){ + @Override + public void run() { + System.out.println("Thread: "+Thread.currentThread().getName()+" started"); + } + }); + } +} \ No newline at end of file diff --git a/core-java-modules/core-java/src/main/java/com/baeldung/lambdaexpression/LambdaExpressionExample.java b/core-java-modules/core-java/src/main/java/com/baeldung/lambdaexpression/LambdaExpressionExample.java new file mode 100644 index 0000000000..95128b934c --- /dev/null +++ b/core-java-modules/core-java/src/main/java/com/baeldung/lambdaexpression/LambdaExpressionExample.java @@ -0,0 +1,9 @@ +package com.baeldung.lambdaexpression; + +public class LambdaExpressionExample{ + + public static void main(String[] args){ + Thread t1 = new Thread(()->System.out.println("Thread: "+Thread.currentThread().getName()+" started")); + t1.start(); + } +} \ No newline at end of file