⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 runnable.java

📁 由于想一次上传成功 所以将二个教程打包成了一个 这些例子几乎包含了所有java的框架集合
💻 JAVA
字号:
class SecondThread implements Runnable 
{
    Thread thread;

    SecondThread() 
    {
        thread = new Thread(this, "second");
        System.out.println("Starting second thread");
        thread.start(); 
    }

    public void run() 
    {
        try {
            for(int loop_index = 0; loop_index < 10; loop_index++) {
                System.out.println((Thread.currentThread()).getName() 
                    + " thread here...");
                Thread.sleep(1000);
            }
        } catch (InterruptedException e) {}

        System.out.println("Second thread ending.");
    }
}

class runnable 
{
    public static void main(String args[]) 
    {
        SecondThread secondthread = new SecondThread(); 

        try {
            for(int loop_index = 0; loop_index < 10; loop_index++) {
                System.out.println((Thread.currentThread()).getName() 
                    + " thread here...");
                Thread.sleep(1000);
            }
        } catch (InterruptedException e) {}
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -