This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyThread { | |
public static void main(String[] args) { | |
for (int count = 0; count < 10; count++) { | |
Thread thread = new Thread(()->{ | |
System.out.println("Thread "+Thread.currentThread().getName()+" is going to start"); | |
try{ | |
Thread.sleep(500); | |
} catch(InterruptedException exception){ | |
exception.getMessage(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyThread { | |
public static void main(String[] args) { | |
for (int count = 0; count < 10; count++) { | |
Thread thread = new Thread(() -> { | |
System.out.println(Thread.currentThread().getName() + ": Child Thread"); | |
}); | |
thread.start(); | |
} | |
for (int count = 0; count < 10; count++) { | |
System.out.println(Thread.currentThread().getName() + ": Main Thread " + count); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
import java.util.List; | |
import java.util.function.Consumer; | |
import java.util.function.Function; | |
import java.util.function.Predicate; | |
import java.util.function.Supplier; | |
class Student { | |
//roll number assigner used by supplier | |
static int rollNoAssigner; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@FunctionalInterface | |
interface FuncInt1{ | |
void abstractMethod(String var); | |
} | |
@FunctionalInterface | |
interface Funcint2 extends FuncInt1{ | |
void abstractMethod(String var); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@FunctionalInterface | |
interface FuncInt1{ | |
void abstractMethod(); | |
} | |
@FunctionalInterface | |
interface Funcint2 extends FuncInt1{ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@FunctionalInterface | |
interface FuncInterface{ | |
void abstractMethod(); | |
default void defaultMethod(){ | |
//optional default method with some default implementation | |
} | |
static void staticMethod(){ | |
//optional static method with some implementation | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Interface { | |
int add(int x,int y); | |
} | |
class MethodReference { | |
void sum(int a,int b){ | |
System.out.println(a+b); | |
//return a+b; | |
} | |
public static void main(String[] args) { | |
Interface i = new MethodReference()::sum; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git config --global user.name <Your name> |
NewerOlder