Control of running Thread using multiple threading concept of java
I just want to start and stop the thread when return key is pressed. Here thread is stopped fine but i cant Start that thread again please help. Also explain me the use of volatile keyword .Is it helpful for me to over come this problem. public class Sync extends Thread{ public boolean meth= true; public void run(){ while(meth){ System.out.println("hello"); try { Thread.sleep(1000); } catch (InterruptedException ex) { } } } public void shutdown(){ meth=false; } public void startup(){ meth=true; } } MAIN CLASS`` package com.Sync; import java.util.Scanner; public class SyncMain { public static