Chinaunix首页 | 论坛 | 博客
  • 博客访问: 77547
  • 博文数量: 22
  • 博客积分: 1250
  • 博客等级: 中尉
  • 技术积分: 305
  • 用 户 组: 普通用户
  • 注册时间: 2007-04-19 09:44
文章分类

全部博文(22)

文章存档

2009年(2)

2008年(20)

我的朋友

分类: Java

2008-10-13 11:39:09

程序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;
}
}
阅读(763) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~