zoukankan      html  css  js  c++  java
  • Document

    前言:多线程的知识

    代码:

     1 package com.day13.math;
     2 /** 
     3 * 类说明 :模拟QQ聊天与视频聊天同时进行
     4 * @author 作者 : chenyanlong 
     5 * @version 创建时间:2017年10月29日 
     6 */
     7 
     8 public class ThreadTest {
     9 
    10     public static void main(String[] args) {
    11         TalkThread talkThread=new TalkThread();
    12         VideoThread  videoThread=new VideoThread();
    13         talkThread.start();
    14         videoThread.start();
    15     }
    16 }
    17 
    18 
    19 //发起视频
    20 class TalkThread extends Thread{
    21     
    22     //重写run()方法
    23     @Override
    24     public void run(){
    25         while(true){
    26             System.out.println("霞霞,开视频呗!");
    27         }
    28     }
    29 }
    30 
    31 
    32 //视频
    33 class VideoThread extends Thread{
    34     //重写run方法
    35     @Override
    36     public void run(){
    37         while(true){
    38             System.out.println("好啊,那开视频呀!");
    39         }
    40     }
    41 }
    View Code

    运行效果:

  • 相关阅读:
    100-days: twelve
    100-days: eleven
    100-days: ten
    [PKUWC 2018]随机算法
    [CTSC 2018]假面
    APIO 2018 游记
    CTSC 2018 游记
    [CQOI 2018]解锁屏幕
    [CQOI 2018]九连环
    [CQOI 2018]破解D-H协议
  • 原文地址:https://www.cnblogs.com/chenyanlong/p/7749583.html
Copyright © 2011-2022 走看看