Java GregorianCalendar getLeastMaximum()方法与示例

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值