java.time.LocalTime.isBefore() 方法
描述
java.time.LocalTime.isBefore(LocalTime other) 方法检查此时间是否早于指定时间。
声明
以下是 java.time.LocalTime.isBefore(LocalTime other) 方法的声明。
public boolean isBefore(LocalTime other)
参数
other − 另一个比较的时间,不为空。
返回值
如果此时间早于指定时间,则为真。
示例
下面的例子展示了 java.time.LocalTime.isBefore(LocalTime other) 方法的使用。
package com.tutorialspoint;
import java.time.LocalTime;
public class LocalTimeDemo {
public static void main(String[] args) {
LocalTime time = LocalTime.parse("12:30:30");
LocalTime time1 = LocalTime.parse("12:35:30");
System.out.println(time1.isBefore(time));
}
}
让我们编译并运行上面的程序,这将产生下面的结果 −
false

