Chinaunix首页 | 论坛 | 博客
  • 博客访问: 29943775
  • 博文数量: 708
  • 博客积分: 12163
  • 博客等级: 上将
  • 技术积分: 8240
  • 用 户 组: 普通用户
  • 注册时间: 2007-12-04 20:59
文章分类

全部博文(708)

分类: Java

2008-10-27 14:27:01

1.
 
import java.io.*;
public class Hello {
      
      static String str ;
      String he() {
              BufferedReader y = new BufferedReader(new InputStreamReader(System.in));
       try  {
         String str = y.readLine();
                 }
           catch(IOException   ioe)  
                        {  
            System.out.println("IOException:"+ioe);
                 }
                 return str;
                    }  
        public static void main (String[] args) {
        System.out.println("type the word");
 
              Hello x = new Hello();
             String str = x.he();
          System.out.println(str);
                    }
        }
 
2.
 
 
//file:Input.java
import java.io.*;
public class Input
{
public static void main(String[] args)
{
String str;
str = Input();
System.out.println(str);
}
private static String Input()
{
BufferedReader br = new BufferedReader( new InputStreamReader( System.in ));
String ret = "";
try
{
ret = br.readLine();
}
catch( IOException e )
{
}
return ret;
}
}
阅读(1879) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~