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;
}
}
阅读(1909) | 评论(0) | 转发(0) |