/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		method1();
	}
	static boolean method2Continue = false;

public static void method1() {
    Thread thread = new Thread(() -> method2());
    thread.start();
    if(true){
    	for(int i = 0; i < 10000000; i++); // delay to allow method2 to start
    	System.out.println("Allowing method2 to continue");
        method2Continue = true;
    }
    thread.interrupt();
}
public static void method2() {
    // ...
    System.out.println("method2");
    while(!method2Continue);
    System.out.println("method2 has been allowed to continue");
    // ...
}
}