import java.io.*;public class LittleTest{
public static void main (String[] args) throws IOException
{
System.out.println ("请输入一个整数数值:");
int a=System.in.read();
System.out.println ("打印出输入的值a="+a);
}
}
//输出结果如下:
请输入一个整数值:
25
50Process completed.//疑问
不应该就是25嘛?怎么的输出就变成50了!
感激涕零o(∩_∩)o...
public static void main (String[] args) throws IOException
{
System.out.println ("请输入一个整数数值:");
int a=System.in.read();
System.out.println ("打印出输入的值a="+a);
}
}
//输出结果如下:
请输入一个整数值:
25
50Process completed.//疑问
不应该就是25嘛?怎么的输出就变成50了!
感激涕零o(∩_∩)o...
throws IOException Reads the next byte of data from the input stream. The value byte is returned as an int in the range 0 to 255. If no byte is available because the end of the stream has been reached, the value -1 is returned. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown. A subclass must provide an implementation of this method. Returns:
the next byte of data, or -1 if the end of the stream is reached.
Throws:
IOException - if an I/O error occurs.
Scanner s=new Scanner(System.in);
System.out.print ("请输入一个整数数值:");
String a=s.nextLine(); System.out.println ("打印出输入的值a="+a); }
}
25 的话 获取 2,并返回2的ascii码50
system.out.print直接输出50
25 的话 获取 2,并返回2的ascii码50 得字符串我用
String info = new javax.swing.JOptionPane().showInputDialog("Input:");还可以用fileReader吧?忘了。