zoukankan      html  css  js  c++  java
  • 回车键

    public class Test {

     public static void main(String[] args) {      

      String s=null;  

       //字符缓冲区,System.in系统输入   

      BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));   

      System.out.println("请输入:");   

      try {   

         //读取系统输入的数据   

         s=bf.readLine();   

      } catch (Exception e) {   

         // TODO Auto-generated catch block   

         e.printStackTrace();   

      }finally{   

         try {    

           //关闭缓冲区    

           bf.close();    

          } catch (Exception e) {  

             // TODO Auto-generated catch block     

            e.printStackTrace();   

            }   }

         if(s!=null){    

          //如果是回车键,那么长度为0  

            if(s.length()==0){   

            System.out.println("你输入的是空格键");    

          }else {     

            System.out.println(s);    

        }   }  

        }

    }

  • 相关阅读:
    生成器
    ELK出现unassigned_shards解决办法
    ElK集群 采集 redis 数据
    postgresql-12编译安装
    openshift 3.11安装部署
    Linux TCP漏洞 CVE-2019-11477 CentOS7 修复方法
    zabbix-server安装部署配置
    zabbix-proxy安装部署
    harbor镜像仓库-02-https访问配置
    harbor镜像仓库-01-搭建部署
  • 原文地址:https://www.cnblogs.com/danmao/p/3807190.html
Copyright © 2011-2022 走看看