Advertisement
kanagara

Untitled

May 23rd, 2020
1,724
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.42 KB | None | 0 0
  1. public class ThreadTest {
  2.    public static void main(String[] args) {
  3.       Runnable r1 = new Runnable() { // Anonimna klasa
  4.       @Override
  5.       public void run() {
  6.          System.out.println("Using Anonymous class");
  7.       }
  8.    };
  9.       Runnable r2 = () -> { // Lambda izraz
  10.          System.out.println("Using Lambda Expression");
  11.       };
  12.       new Thread(r1).start();
  13.       new Thread(r2).start();
  14.    }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement