码迷,mamicode.com
首页 > 其他好文 > 详细

课堂复习内容(1)

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

标签:bsp   rgs   stat   sys   system.in   void   har   exti   static   

        扫描仪类:

               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)

标签:bsp   rgs   stat   sys   system.in   void   har   exti   static   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!