⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 shuru.java

📁 接口练习 输入 浮点数 整数 字符 字符串
💻 JAVA
字号:
package test4;import java.io.*;/** * <p>Title: test4</p> * <p>Description: 接口练习</p> * <p>Copyright: Copyright (c) 2009</p> * <p>Company: 0711304034</p> * @author 张海军 * @version 1.0 */public class Shuru {     private InputStreamReader in=new InputStreamReader(System.in);     private BufferedReader reader=new BufferedReader(in);     public String readString() {            String s="";            try {                  s=reader.readLine();            } catch(IOException e) {                  System.out.println(e);                  System.exit(0);            }            return s;      }     public char readChar() {            char ch=' ';            try {                  String s=readString();                  ch=s.charAt(0);            } catch(Exception e) {                  System.out.println("Error input type. The program will exit.");                  System.exit(0);            }            return ch;      }     public int readInt() {            String s=readString();            int i=0;            try {                  i=Integer.parseInt(s);            } catch(Exception e) {                  System.out.println("Error input type. The program will exit.");                  System.exit(0);            }            return i;      }     public double readDouble() {            String s=readString();            double d=0.0;            try {                  d=Double.parseDouble(s);            } catch(Exception e) {                  System.out.println("Error input type. The program will exit.");                  System.exit(0);            }            return d;      }     public float readFloat() {            String s=readString();            float f=0.0f;            try {                  f=Float.parseFloat(s);            } catch(Exception e) {                  System.out.println("Error input type. The program will exit.");                  System.exit(0);            }            return f;      }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -