进程:

第一种方法:通过Runtime类的exec()方法来创建进程

public static void main(String[] args) throws Exception {
	Runtime run = Runtime.getRuntime();
	        //打开记事本
	        run.exec("notepad");
}

第二种方法:通过ProcessBuilder创建进程

public static void main(String[] args) throws Exception {
        //打开记事本
        ProcessBuilder pBuilder = new ProcessBuilder("notepad");
        pBuilder.start();
    }

线程:

第一种方法:继承Thread类,重写run()方法,调用start()方法启动线程

class Thread1 extends Thread{
    @Override
    public void run() {
         System.out.println("线程输出");
    }
}
 
public static void main(String[] args) {
            System.out.println("线程启动");
            Thread1 th1 = new Thread1();
            th1.start();
  }

第二种方法:实现Runnable接口,重写run()方法,调用start()方法启动线程
1、Runnable接口应由任何类实现,其实例将由线程执行。 该类必须定义一个无参数的方法,称为run 。
2、该接口旨在为希望在活动时执行代码的对象提供一个通用协议。此类整个只有一个 run() 抽象方法

class Runnable1 implements Runnable{
    @Override
    public void run() {
         System.out.println("线程输出");
    }
}

 public static void main(String[] args) {
            System.out.println("线程启动");
            Thread1 th1 = new Thread1(new Runnable1());
            th1.start();
  }

第三种方法:使用匿名内部类直接创建线程

public static void main(String[] args) {
 			new Thread(new Runnable() {
                    @Override
                    public void run() {
                          System.out.println("线程启动");
                    }
                }).start();
  }

### 注意:
1、启动线程的是start方法,线程使用的是run方法
2、不能重复调用同一个线程,否则会报错