单列体现(Runtime)
package test; import java.util.*; import java.util.concurrent.SynchronousQueue; import java.util.concurrent.locks.Lock; import javax.print.attribute.IntegerSyntax; import org.omg.CosNaming.NamingContextExtPackage.AddressHelper; import privateclass.*; import java.io.*; public class Main { private static final String space_operator = " "; public static void main(String[] args) throws Exception { /* *Runtime是一个单列 *可以直接开启一个程序 *并且我们可以让线程停一下观察杀死程序的过程 */ Scanner scanner = new Scanner(new BufferedInputStream(System.in)); //PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); Runtime e = Runtime.getRuntime(); Process p = e.exec("notepad.exe"); Thread.sleep(5000); p.destroy(); } }