GregorianCalendar类的getLeastMaximum()方法 (GregorianCalendar Class getLeastMaximum() method)
getLeastMaximum() method is available in java.util package.
getLeastMaximum()方法在java.util包中可用。
getLeastMaximum() method is used to get the least maximum value of the specified calendar field (fi) in this GregorianCalendar object.
getLeastMaximum()方法用于获取此GregorianCalendar对象中指定日历字段(fi)的最小值。
getLeastMaximum() method is a non-static method, it is accessible with class object only and if we try to access the method with class name then we will get an error.
getLeastMaximum()方法是一个非静态方法,仅可通过类对象访问,如果尝试使用类名访问该方法,则会收到错误消息。
getLeastMaximum() method does not throw an exception at the time of returning least maximum value that the given field can hold.
返回给定字段可以容纳的最小最大值时, getLeastMaximum()方法不会引发异常。
Syntax:
句法:
public int getLeastMaximum(int fi);
Parameter(s):
参数:
int fi – represents the GregorianCalendar field (fi).
int fi –表示GregorianCalendar字段(fi)。
Return value:
返回值:
The return type of this method is int, it returns the least maximum value of the given field (fi).
此方法的返回类型为int ,它返回给定字段(fi)的最小最大值。
Example:
例:
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class RegexMatches {
public static void main(String args[]) {
// String to be scanned to find the pattern.
String line = "This order was placed for QT3000! OK?";
String pattern = "(.*)(\\d+)(.*)";
// Create a Pattern object
Pattern r = Pattern.compile(pattern);
// Now create matcher object.
Matcher m = r.matcher(line);
if (m.find()) {
System.out.println("Found value: " + m.group(0));
System.out.println("Found value: " + m.group(1));
System.out.println("Found value: " + m.group(2));
} else {
System.out.println("NO MATCH");
}
}
}
Output
输出量
Found value: This order was placed for QT3000! OK?
Found value: This order was placed for QT300
Found value: 0
翻译自: https://www.includehelp.com/java/gregoriancalendar-getleastmaximum-method-with-example.aspx