Java continue break creates simple chat room programs to shield uncivilized languages and display the chat time of each sentence. Simple chat rooms are uncivilized.

Source: Internet
Author: User

Java continue break creates simple chat room programs to shield uncivilized languages and display the chat time of each sentence. Simple chat rooms are uncivilized.

Package com. swift; import java. text. simpleDateFormat; import java. util. date; import java. util. listener; public class ChatWithBreakContinue {public static void main (String [] args) {consumer scan = new consumer (System. in); Date date = null; // long timeMillis = date. getTime (); // long timeMillis2 = System. currentTimeMillis (); System. out. println ("welcome to the simple chat program"); System. out. println ("enter your name"); String name = scan. nextLine (); System. out. println ("started chatting"); System. out. println ("goodbye to chat"); for (;) {String msg = scan. nextLine (); date = new Date (); SimpleDateFormat sdf = new SimpleDateFormat ("yyyy-MM-dd hh: mm: ss"); String time = sdf. format (date); if (msg. equals ("goodbye") {break;} else if (msg. equals ("idiot") {System. out. println ("note civilized terms"); continue;} else if (msg. equalsIgnoreCase ("shazi") {System. out. println ("note civilized terms"); continue;} else if (msg. equals ("stupid") {System. out. println ("Pay attention to civilized terms"); continue;} System. out. println ("192.168.1. * "+ name +" said: "+ msg +" "+ time );}}}

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.