Topic: [other]使用import.java.io.*的问题

  Print this page

1.[other]使用import.java.io.*的问题 Copy to clipboard
Posted by: ice
Posted on: 2004-09-17 11:39

下面我想写成 键盘输入shuru的值,然后pc再输出一边。达到了解io的目的。但是始终javac时错误,请指点。
import java.io.*;
public class ice
{
public static void main(String[] args)
  {
  float shuru
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
  String inputLine = in.readLine();
  shuru = Float.valueOf(inputLine).floatValue();
System.out.println( shuru );
  }
}

2.Re:[other]使用import.java.io.*的问题 [Re: ice] Copy to clipboard
Posted by: huxiaosc
Posted on: 2004-09-28 12:46

package test;
import java.io.*;

public class Untitled1 {
public Untitled1() {
}
public static void main(String[] args)
{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String inputLine = null;
try {
inputLine = in.readLine();
}
catch (IOException ex) {
}
System.out.println(inputLine);
}}

3.菜,我帮泥 [Re: ice] Copy to clipboard
Posted by: battlekiller
Posted on: 2004-09-28 20:37

import java.io.*;
public class Yn{
public static void main(String args[])throws IOException
{
int a=0;
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String str=in.readLine();
a=Integer.paseInt(str);//我是在网吧打的,不知道这个单词对不对,泥仔细看看
System.out.println("刚才输入的是:"+a);
//当输入整数时正常,输入字符会有输入异常

}

}


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923