码迷,mamicode.com
首页 > 编程语言 > 详细

Java输入

时间:2016-11-05 09:39:22      阅读:215      评论:0      收藏:0      [点我收藏+]

标签:bool   blog   next   can   round   back   out   技术分享   boolean   

键盘输入

   可以用Scanner类创建一个对象:

Scanner reader = new Scanner(System.in);

  reader对象用于调用各种方法完成输入类型;

       1:nextBoolean()

       2:nextByte()

       3:nextShort()

       4:nextInt()

       5:nextLong()

       6:nextFloat()

       7:nextDouble()

import java.util.Scanner;
Rect rectangle = new Rect();
Scanner reader = new Scanner(System.in); System.out.printf("请输入矩形的宽,并回车确认"); rectangle.width = reader.nextDouble();

技术分享

                      

 

Java输入

标签:bool   blog   next   can   round   back   out   技术分享   boolean   

原文地址:http://www.cnblogs.com/ZXWds/p/6032407.html

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