- java.time Package Classes
- java.time - Home
- java.time - Clock
- java.time - Duration
- java.time - Instant
- java.time - LocalDate
- java.time - LocalDateTime
- java.time - LocalTime
- java.time - MonthDay
- java.time - OffsetDateTime
- java.time - OffsetTime
- java.time - Period
- java.time - Year
- java.time - YearMonth
- java.time - ZonedDateTime
- java.time - ZoneId
- java.time - ZoneOffset
- java.time Package Enums
- java.time - Month
- java.time Useful Resources
- java.time - Discussion
java.time.MonthDay.query() Method Example
Description
The java.time.MonthDay.query(TemporalQuery<R> query) method queries this month-day using the specified query.
Declaration
Following is the declaration for java.time.MonthDay.query(TemporalQuery<R> query) method.
public <R> R query(TemporalQuery<R> query)
Parameters
query − the query to invoke, not null.
Return Value
the query result, null may be returned (defined by the query).
Exceptions
DateTimeException − if unable to query (defined by the query).
ArithmeticException − if numeric overflow occurs (defined by the query).
Example
The following example shows the usage of java.time.MonthDay.query(TemporalQuery<R> query) method.
package com.tutorialspoint; import java.time.MonthDay; import java.time.temporal.TemporalQueries; public class MonthDayDemo { public static void main(String[] args) { MonthDay date = MonthDay.parse("--10-15"); System.out.printf("MonthDay Chronology is %s%n", date.query(TemporalQueries.chronology())); } }
Let us compile and run the above program, this will produce the following result −
MonthDay Chronology is ISO
Advertisements