java scanner_Java Scanner match()方法与示例
java scanner
扫描器类match()方法 (Scanner Class match() method)
match() method is available in java.util package.
match()方法在java.util包中可用。
match() method is used to get the MatchResult of the last scanning operation operated by this Scanner.
match()方法用于获取此Scanner上次操作的MatchResult。
match() method is a non-static method, it is accessible with the class object only and if we try to access the method with the class name then we will get an error.
match()方法是一种非静态方法,只能通过类对象访问,如果尝试使用类名称访问该方法,则会收到错误消息。
match() method may throw an exception at the time of returning MatchResult. IllegalStateException: This exception may throw when none match result exists.
match()方法在返回MatchResult时可能会引发异常。 IllegalStateException :如果不存在匹配结果,则可能引发此异常。
Syntax:
句法:
public MatchResult match();
Parameter(s):
参数:
It does not accept any parameter.
它不接受任何参数。
Return value:
返回值:
The return type of the method is MatchResult, it gets match result for the last matching operation.
该方法的返回类型为MatchResult ,它获取上一次匹配操作的匹配结果。
Example:
例:
// Java program to demonstrate the example
// of MatchResult match() method of Scanner
import java.util.*;
public class MatchOfScanner {public static void main(String[] args) {String str = "Hi, [IncludeHelp] +\n 10.0 true ";
// Instantiates a Scanner object with
// the given string str
Scanner sc = new Scanner(str);
// Display str
System.out.println("sc.nextLine(): " + sc.nextLine());
// By using match() method is
// to match the last scanning
// operation performed by this Scanner
System.out.println("sc.match(): " + sc.match());
// By using close() method is to
// close the Scanner object
sc.close();
}
}
Output
输出量
sc.nextLine(): Hi, [IncludeHelp] +
sc.match(): [email protected]
翻译自: https://www.includehelp.com/java/scanner-match-method-with-example.aspx
java scanner
java scanner_Java Scanner match()方法与示例相关推荐
- java的scanner的方法_Java Scanner reset()方法
Java Scanner reset()方法 java.util.Scanner.reset() 方法重置该扫描仪.重设scanner 丢弃所有的这些可能已被useDelimiter(java.uti ...
- java散列法的运用实例,Java HashMap compute() 使用方法及示例
Java HashMap compute() 使用方法及示例 Java HashMap compute()方法计算一个新值,并将其与哈希映射中的指定键相关联. compute()方法的语法为: has ...
- math的用法在java中的使用,Java Math cbrt() 使用方法及示例
Java Math cbrt() 使用方法及示例 Java Math cbrt()方法返回指定数字的立方根. cbrt()方法的语法为: Math.cbrt(double num) 注意:cbrt() ...
- java arraylist 方法返回值,Java ArrayList get() 使用方法及示例
Java ArrayList get() 使用方法及示例 Java ArrayList get()方法返回指定位置存在的元素. get()方法的语法为: arraylist.get(int index ...
- java scanner_Java Scanner nextLong()方法与示例
java scanner 扫描器类的nextLong()方法 (Scanner Class nextLong() method) Syntax: 句法: public long nextLong(); ...
- java scanner_Java Scanner skip()方法与示例
java scanner 扫描仪类skip()方法 (Scanner Class skip() method) Syntax: 句法: public Scanner skip(Pattern patt ...
- java scanner_Java Scanner radix()方法与示例
java scanner 扫描器类radix()方法 (Scanner Class radix() method) radix() method is available in java.util p ...
- java scanner_Java Scanner nextDouble()方法与示例
java scanner 扫描仪类的nextDouble()方法 (Scanner Class nextDouble() method) nextDouble() method is availabl ...
- java kryo_Kryo框架使用方法代码示例
Kryo框架的source已移至https://github.com/EsotericSoftware/kryo ,进入此页面,然后点击右边的Download Zip按钮,就能下载到最新版本的Kryo ...
最新文章
- 【CCIE学习干货】LDP:标签的那些事儿
- C语言实现常用数据结构——队列
- WEBGIS体系和OGC标准
- 【操作系统】实验 模拟操作系统的文件管理系统
- linux内存管理总结
- ubuntu16.04源码编译安装nginx1.16.2
- dvm与art的区别_Android运行时– DVM与ART,AOT与JIT
- CentOS 6.3 编译安装搭建LNMP(迎接端午节,首发)
- WCF编程]WCF使用Net.tcp绑定时候出现错误:元数据包含无法解析的引用
- android入门级智能手表产地,从全球智能手表市场来看,Android智能手表只在中国卖得好...
- Java中静态代码块、构造代码块的区别
- 详解各种光学仪器成像原理
- ML-Agents训练智能AI使用技巧
- SLG变现强劲,却易遭黑产侵袭,如何破局?SLG游戏安全方案定制做到出奇制胜!
- new date的含义
- [Android] 该文件包与具有同一名称的现有文件包存在冲突
- 电脑英语Computer English
- 如何在 SubSystem for Android 上安装应用?
- mysql 13位时间戳转时间戳_时间戳换算(13位时间戳转换工具 在线)
- Android下载图片并添加图片水印
热门文章
- axure原件 总是丢失_Axure实现提示文本单击显示后自动消失的效果
- 玩转linux文件描述符和重定向,玩转Linux文件描述符和重定向
- javascript字典中添加数组_如何在 JavaScript 中更好地使用数组
- python爬电影_使用Python多线程爬虫爬取电影天堂资源
- python字符串前面加f什么意思_Python 字符串前面加u,r,b,f的含义
- dhcp只能分配与路由器相同网段么_路由器的桥接详解
- 性能测试总结(一)---基础理论篇(转载)
- Centos 7初始化脚本
- MySQL定义数据库对象之指定definer
- 李洪强iOS开发之FMDB线程安全的用法