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

📄 threadtest1.java.bak

📁 Java程序设计培训教程2
💻 BAK
字号:
class ThreadTest1{
	public static void main(String args[]) {
		/*下面两个语句用于输出提示信息*/
		System.out.println("This an example about creating thread by inheriting from Thread class.");
		/*启动名为“Jon”的线程*/
		new SubThread("Jon").start();
	}
}
/*类SubThread是Thread的子类,在该类中,通过run()方法输出正在运行的线程的名称*/
class SubThread extends Thread {
	/*构造方法生成一个名称为str的线程对象*/
	public SubThread(String str) {
		super(str);
	}
	/*run()方法输出正在运行的线程名称*/
	public void run() {
		System.out.println("Thread "+getName() + ": " + "running!");
	}
}

		

⌨️ 快捷键说明

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