Java的输入函数是什么?

detrox 2004-09-06 12:22:57
System.out.println可以输出,那输入函数是什么啊?
...全文
913 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
ittraining 2004-09-06
  • 打赏
  • 举报
回复
http;//j.topcool.net/ittraining/ittraining1.htm
zgysc 2004-09-06
  • 打赏
  • 举报
回复
System.in
射天狼 2004-09-06
  • 打赏
  • 举报
回复
System.out.print ("输入第一个数:");
i = System.in.read ();
while (i != 13)
{
if (((i >= 48) && (i <= 57)) || i == 46)
{
strTmp += (char) i;
}

i = System.in.read ();
}
pingfan520 2004-09-06
  • 打赏
  • 举报
回复
try{
System.out.println("请输入一个整形数");
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
s=br.readLine();
i=Integer.parseInt(s);
catch(IOException e){}
qgdeng 2004-09-06
  • 打赏
  • 举报
回复

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.lang.NumberFormatException;

/**
* <p>Title: Pack standard input </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Company: Jinfonet </p>
* @author zhijun.wu
* @version 1.0
*/

public class StandardInputReader {
private static BufferedReader reader = new BufferedReader(
new InputStreamReader(System.in));



/**
* Read a boolean value from standard input stream.
*
* @return a boolean value.
* @throws IOException
*/
public static boolean readBoolean() throws IOException {
String strBoolean = reader.readLine();

// return Boolean.valueOf(strBoolean).booleanValue();
if (strBoolean.equalsIgnoreCase("true")) {
return true;
} else if (strBoolean.equalsIgnoreCase("false")) {
return false;
} else {
throw new NumberFormatException("For input string: \""
+ strBoolean +"\"");
}
}

/**
* Read a byte value from standard input stream.
*
* @return a byte value.
* @throws IOException
*/
public static byte readByte() throws IOException {
return Byte.parseByte(reader.readLine());
}

/**
* Read a short value from standard input stream.
*
* @return a short value.
* @throws IOException
*/
public static short readShort() throws IOException {
return Short.parseShort(reader.readLine());
}

/**
* Read a int value from standard input stream.
*
* @return a int value.
* @throws IOException
*/
public static int readInt() throws IOException {
return Integer.parseInt(reader.readLine());
}

/**
* Read a long value from standard input stream.
*
* @return a long value.
* @throws IOException
*/
public static long readLong() throws IOException {
return Long.parseLong(reader.readLine());
}

/**
* Read a float value from standard input stream.
*
* @return a float value.
* @throws IOException
*/
public static float readFloat() throws IOException {
return Float.parseFloat(reader.readLine());
}

/**
* Read a double value from standard input stream.
*
* @return a double value.
* @throws IOException
*/
public static double readDouble() throws IOException {
return Double.parseDouble(reader.readLine());
}

/**
* Read a line of text. A line is considered to be terminated by any one
* of a line feed ('\n'), a carriage return ('\r'), or a carriage return
* followed immediately by a linefeed.
*
* @return A String containing the contents of the line, not including
* any line-termination characters, or null if the end of the
* stream has been reached
*
* @exception IOException If an I/O error occurs
*/
public static String readLine() throws IOException {
return reader.readLine();
}


}
无欲则钢 2004-09-06
  • 打赏
  • 举报
回复
BufferedReader
healer_kx 2004-09-06
  • 打赏
  • 举报
回复
回答Reader的一律算错行不?
casinosun 2004-09-06
  • 打赏
  • 举报
回复
Reader
bluesky35 2004-09-06
  • 打赏
  • 举报
回复
System.in.read ();

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧