黑马程序员,黑马论坛------Scanner的小问题(大家来找茬)

来源:互联网 发布:西安丝路软件 编辑:程序博客网 时间:2024/05/01 23:47

来源:黑马程序员,黑马论坛

 

 

package cn.itcast_02;
import java.util.Scanner;
/* 这是今天的练习:
* Scanner的小问题(大家来找茬):
*               请指出哪一种有问题???说明原因,我不是很理解。谢谢帮助!
*
*/
public class ScannerDemo {
        public static void main(String[] args) {
                Scanner sc = new Scanner(System.in);
//1
             // int -- int
                // int x = sc.nextInt();
                // int y = sc.nextInt();
//2
                // String --String
                // String x = sc.nextLine();
                // String y = sc.nextLine();
//3
                // String -- int
                // String x = sc.nextLine();
                // int y = sc.nextInt();
        
          //4
                // int--String
                //int x = sc.nextInt();
                //String y = sc.nextLine();
                System.out.println(x);
                System.out.println(y);
        }
}

 

0 0
原创粉丝点击