w*******u 发帖数: 15 | 1 我发现有个网友写过,但不能用.本人刚刚接触java,谢谢大家帮忙!!!!
float x = 0.0;
String line = null;
try {
line = System.in.readLine();
}catch (IOException e)//i guess here " e" should be"exc",but still doesn't
work
{
}
if (line!=null && line.length>0) {
try {
x = Float.parsefloat(line);
} catch (NumberFormatException e)// i guess here " e" should be"exc"
{
} |
st 发帖数: 1685 | 2 怎么不能用了?
【在 w*******u 的大作中提到】 : 我发现有个网友写过,但不能用.本人刚刚接触java,谢谢大家帮忙!!!! : float x = 0.0; : String line = null; : try { : line = System.in.readLine(); : }catch (IOException e)//i guess here " e" should be"exc",but still doesn't : work : { : } : if (line!=null && line.length>0) {
|
w*******u 发帖数: 15 | 3 when i complie it,the computer said:
% javac Bookentry.java
Bookentry.java:47: Type expected.
try {
^
: 【 在 williamyu (williamyu) 的大作中提到: 】
doesn't
【在 st 的大作中提到】 : 怎么不能用了?
|
st 发帖数: 1685 | 4 it seems to be basic java problem, read basic java sample and tutorial first.
【在 w*******u 的大作中提到】 : when i complie it,the computer said: : % javac Bookentry.java : Bookentry.java:47: Type expected. : try { : ^ : : : 【 在 williamyu (williamyu) 的大作中提到: 】 : doesn't
|
f**t 发帖数: 27 | 5
}
~~~~~~~~~~~~~~~~~~~~~
readLine() is not InputStream member function, belongs BufferedReader()
order you can use read()
doesn't
【在 st 的大作中提到】 : it seems to be basic java problem, read basic java sample and tutorial first.
|