zoukankan      html  css  js  c++  java
  • 第16周作业


    题目1:编写一个应用程序,利用Java多线程机制,实现时间的同步输出显示。

    package ccut;
    
    import java.util.Date;
    
    public class ThreadTime extends Thread  {
    	public void run(){
    	Date time;
    	while(true) {
    		time=new Date();
    		System.out.println(time);
    		try {
    				sleep(1000);
    		
    		}catch(InterruptedException e) {
    			e.printStackTrace();
    			
    			
    		}
    	
    		
    		
    	}
    	
    
    }
    }
    

      

    package ccut;
    
    public class text {
    
    	public static void main(String[] args) {
    		ThreadTime t=new ThreadTime();
    		t.run();
    	}
    
    }
    

      

  • 相关阅读:
    Java的特性和优势
    MyBatis
    SpringBoot简介
    Liunx
    MySql简介与入门
    Volatile
    MySQL简介
    Redis
    Spring IoC
    什么是springboot
  • 原文地址:https://www.cnblogs.com/guoxiang19/p/12081229.html
Copyright © 2011-2022 走看看