English 中文(简体)
java conole submissions
原标题:java console input
  • 时间:2010-05-25 04:45:03
  •  标签:
  • java

通过青少年(如使用BufferedReader类)提供的任何投入的数据类型正在缩小。 在这种分类之后,我们重新排列了数据类型(作为间歇化数据)。 但是,在C中,我们可以对任何原始数据类型的投入,而在java,所有投入类型都属实。 为什么?

最佳回答

青春期投入实际上作为一系列的tes,而不是一种强硬。 这是因为:System.in, 即作为InputStream载录。 JDK1.5前的典型总结(Scanner 类别!)是:

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

i.e.InputStreamReader 将星流转化为品流,然后改为<代码> http://www.un.org/Depts/DGACM/index_chinese.htm

因此,它包含一个<代码>String输出,因为你从您的<代码>中重新获得特性流的缓冲输出。 BufferedReader。

问题回答

在java,你可以做:

Scanner scan = new Scanner(System.in);
scan.nextInt();
scan.nextDouble();

等等。 你需要确保下一个投入是正确的。

EDIT:小姐 我认为,这一答案是完全错误的。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签