java中的用户输入........... [英] user input in java ...........

查看:63
本文介绍了java中的用户输入...........的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在java中获取用户输入?

i知道关于解析的问题吗?

有人可以取消一些文章吗?

how to take user input in java ?
i know a liitle about parse ?
can someone please suugest some articles?

推荐答案

你可以使用扫描仪util类包

首先

import java.utl.Scanner

然后创建该类的对象



扫描仪sc =新扫描仪(System.in);



然后使用适合您数据类型的方法,如果你想要整数那么



int i = sc.nextInt();



我希望有帮助
You Can Use Scanner Class of util package
first
import java.utl.Scanner
then create object of that class

Scanner sc=new Scanner(System.in);

and then use its method appropriate to your data type if you want integer then

int i=sc.nextInt();

I hope that helps


这篇关于java中的用户输入...........的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆