请教一下,关于Scanner的简单程序该如何编写啊
package com.alibaba.test;
// 导包
import java.util.Scanner;
/**
import java.util.Scanner; public class ScannerTest { public static void main(String[] args) { Scanner s = new Scanner(System.in); //receive string String str = s.next(); //receive integer Integer i = s.nextInt(); //receive double Double d = s.nextDouble(); System.out.println(str+i+d); } }
package com.alibaba.test;
// 导包
import java.util.Scanner;
/**
* scanner测试类
*
* @author xxx
*/
public class test {
public static void main(String[] args) {
// 创建一个scanner对象
Scanner scanner = new Scanner(System.in);
// 接收收入的信息
String str = scanner.next();
// 在控制台打印输入的内容
System.out.println(str);
}
}