- import java.io.IOException;
- public class Test01 {
-
- public static void main(String[] args) {
- try {
- System.out.println("请输入你的名字后Enter:");
- byte[] b = new byte[1024];
- int n = System.in.read(b);
- String s = new String(b, 0, n-2); //把用于换行的两个字符\r\n去掉,就可以了
- System.out.println("您输入了--》" + s);
- eat(s);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- public static String eat(String e) {
- System.out.println(e + "要吃龙虾");
- return e;
- }
-
- }
复制代码 |