input3.java

来自「JAVA程序设计课程中各章节的程序实例。」· Java 代码 · 共 53 行

JAVA
53
字号
/**
*Another way in Java to get input from the keyboard,


*/

import java.io.*;

class Input3
{
	public static void main(String args[]) throws IOException
	{
		double value;

		value = getDouble();
		System.out.println(value);
	}

	public static String getString() throws IOException
	{
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));

		return bf.readLine();
	}

	public static int getInt() throws IOException
	{
		String s = getString();

		return Integer.parseInt(s);
	}

	public static char getChar() throws IOException
	{
		String s = getString();

		return s.charAt(0);
	}

	public static double getDouble() throws IOException
	{
		String s = getString();

		return Double.parseDouble(s);
	}

	public static long getLong() throws IOException
	{
		String s = getString();

		return Long.parseLong(s);
	}
}

⌨️ 快捷键说明

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