首页 > 其他 > 详细

课堂复习内容(1)

时间:2017-04-09 14:53:13      阅读:207      评论:0      收藏:0      [点我收藏+]

        扫描仪类:

               import java.util.Scanner;

              Scanner input=new Scanner(System.in);

        示例:   

                import java.util.Scanner;

                 public class Test02 {
                   public static void main(String[] args) {
                    Scanner input = new Scanner(System.in);
                   System.out.println("请输入名字:");
                   String name = input.next();
                   System.out.println("请输入年龄:");
                   int age = input.nextInt();
                   System.out.println("请输入性别:");
                  char gehder = input.next().charAt(0);

                   }
               }

                  获得4位数各位
                    int custNo = input.nextInt();
                   int gewei = custNo % 10;
                  int shiwei = custNo / 10 % 10;
                  int baiwei = custNo / 100 % 10;
                   int qianwei = custNo / 1000;

  

 

课堂复习内容(1)

原文:http://www.cnblogs.com/LWLDD/p/6684539.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!