当前位置:网站首页>10、Scanner. Next() cannot read spaces /indexof -1
10、Scanner. Next() cannot read spaces /indexof -1
2022-07-01 03:35:00 【weixin_ forty-seven million one hundred and twenty-seven thousa】
Cause :
1. Use Scanner.next Get keyboard input name
2.name.indexOf by -1
answer :
next()
1、 Be sure to read valid characters before entering .
2、 Blank space before entering valid characters ,next() Method will automatically remove it .
3、 Only after entering a valid character, the space after it is used as a separator or terminator .
4、next() Cannot get string with space .
nextLine()
1、 With Enter End of character ,nextLine() Method returns all characters before entering carriage return .
2、 Can get blank .
边栏推荐
猜你喜欢

C语言多线程编程入门学习笔记

Take you through a circuit board, from design to production (dry goods)

File upload and download

二叉树神级遍历:Morris遍历

ctfshow爆破wp

Introduction and installation of Solr

Basic concepts of database

Hal library setting STM32 interrupt

Feature pyramid networks for object detection

C # realize solving the shortest path of unauthorized graph based on breadth first BFS -- complete program display
随机推荐
The value of the second servo encoder is linked to the NC virtual axis of Beifu PLC for display
Feature Pyramid Networks for Object Detection论文理解
How do I use Google Chrome 11's Upload Folder feature in my own code?
Hal library setting STM32 interrupt
ES6解构语法详解
ECMAScript 6.0
JS日常开发小技巧(持续更新)
pytorch nn. AdaptiveAvgPool2d(1)
Split(), split(), slice(), can't you tell?
How to use hybrid format to output ISO files? isohybrid:command not found
Appium自动化测试基础 — APPium基本原理
Clion and C language
Feature pyramid networks for object detection
Listener listener
JS daily development tips (continuous update)
ctfshow爆破wp
RSN:Learning to Exploit Long-term Relational Dependencies in Knowledge Graphs
Research on target recognition and tracking based on 3D laser point cloud
4、【WebGIS实战】软件操作篇——数据导入及处理
IPv4和IPv6、局域网和广域网、网关、公网IP和私有IP、IP地址、子网掩码、网段、网络号、主机号、网络地址、主机地址以及ip段/数字-如192.168.0.1/24是什么意思?