博客
关于我
Java如何让程序一直运行,不停止
阅读量:88 次
发布时间:2019-02-26

本文共 537 字,大约阅读时间需要 1 分钟。

如何让程序一直运行,很容易实现,只需要一直等待输出即可啦

  1. import java.util.Scanner;
  2. /*
  3.  * @author LiuYanzhao
  4.  */
  5. public class Test {
  6.     private static final String OPERATION_EXIT = "EXIT";
  7.     public static void main(String[] args) {
  8.         System.out.println("请开始您的输入,EXIT/E 退出");
  9.         //怎么让程序一直运行
  10.         Scanner scan = new Scanner(System.in);
  11.         while(scan.hasNext()) {
  12.             String in = scan.next().toString();
  13.             if(OPERATION_EXIT.equals(in.toUpperCase())
  14.                     || OPERATION_EXIT.substring(01).equals(in.toUpperCase())) {
  15.                 System.out.println("您成功已退出!");
  16.                 break;
  17.             }
  18.             System.out.println("您输入的值:"+in);
  19.         }
  20.     }
  21. }

本文链接:

转载地址:http://mpuu.baihongyu.com/

你可能感兴趣的文章
node中的get请求和post请求的不同操作【node学习第五篇】
查看>>
Node中的Http模块和Url模块的使用
查看>>
Node中自启动工具supervisor的使用
查看>>
Node入门之创建第一个HelloNode
查看>>
node全局对象 文件系统
查看>>
Node出错导致运行崩溃的解决方案
查看>>
Node响应中文时解决乱码问题
查看>>
node基础(二)_模块以及处理乱码问题
查看>>
node安装卸载linux,Linux运维知识之linux 卸载安装node npm
查看>>
node安装及配置之windows版
查看>>
Node实现小爬虫
查看>>
Node提示:error code Z_BUF_ERROR,error error -5,error zlib:unexpected end of file
查看>>
Node提示:npm does not support Node.js v12.16.3
查看>>