reaLine()和read()
来源:互联网 发布:湖北软件开发公司 编辑:程序博客网 时间:2024/05/02 04:18
``` Advances this scanner past the current line and returns the input that was skipped. **This method returns the rest of the current line, excluding any line separator at the end.** **The position is set to the beginning of the next line.** <p>Since this method continues to search through the input looking for a line separator, it may buffer all of the input searching for the line to skip if no line separators are present.readLine(): Scanner in = new Scanner(System.in); System.out.println("enter a number:"); int number = in.nextInt(); switch (number) { case 1:System.out.println("received right"); default: System.out.println("bye"); break; } System.out.print("enter a string"); String nextLine=in.nextLine(); System.out.print("---"+nextLine+"--");----------输出:enter a number:2 hello //这是输入byeenter a string-- hello-- //这里有一个空格
从上一个读取过后的点往后读,读到最后返回的值里面不包括换行符,之后读取的位置变成了下一行的开始
read():
从上一次读过的地方接着读,以空格和换行符为分隔符。不读取换行符。所以碰到换行符时就会等待输入。
0 0
- reaLine()和read()
- 用realine库完善你的my_shell
- read comitted和repeatable read的不同之处
- REPEATABLE-READ和READ-COMMITTED幻读
- read和write函数
- fread和read
- read和write函数
- read和printf
- write和read
- linux fread和read
- fread 和 read
- read和fread
- write和read
- read和write
- fread和read
- mmap和read、write
- read(),readline()和readlines()
- system.in.read和bufferedreader.read和bufferedreader.readline
- Andorid ,遇到bug没人帮?网络提问没有人回?那还等什么?
- 使用sublime一键格式化XML文件
- andriod中的 Application类用法
- Linux命令(5):pwd
- 编写一个程序,查找C语言中的基本语法错误,如圆括号、方括号、花括号不配对等,正确处理引号与注释
- reaLine()和read()
- C++ PRIMER 5th 学习小结(第三章)
- 二叉树的实现
- Android网络请求 ------ Volley的使用
- 分布函数和概率密度函数的区别
- cocos2d-JS 屏幕适配(5种适配模式)
- StringUtils中isEmpty 和isBlank的区别
- 383. Ransom Note [easy] (Python)
- 进程同步