//用Scanner的nextInt()方法得到int类型的数
import java.util.Scanner;
public class ScannerDemo2{
public static void main(String[] args){
Scanner scanner=new Scanner(System.in);
System.out.print("请输入数字:");
System.out.printf("你输入了: %d!\n",scanner.nextInt());
}
}
//用Scanner的next()方法取得字符串输入
import java.util.Scanner;
public class ScannerDemo{
public static void main(String[] args){
Scanner scanner=new Scanner(System.in);
System.out.print("请输入你的名字:");
System.out.printf("aa! %s!\n",scanner.next());
}
}
posted on 2009-03-26 09:26
鹏凌 阅读(1168)
评论(0) 编辑 收藏