Java Instant get() methodThe get() method of Java Instant class is used to get the value of the specified field from this instant as an int. It provides an instant result for the value of the specified field. The returned value will always be within the valid range of values for the field. If it is not possible to return the value because the field is not supported or for some other reason, it throw an exception. SyntaxParametersfield - The field to get, not null. ReturnThe value for the field. ExceptionsDateTimeException - If a value for the field cannot be obtained or the value is outside the range of valid values for the field. UnsupportedTemporalTypeException - If the field is not supported or the range of values exceeds an int. ArithmeticException - If numeric overflow occurs. Example 1Output: The output will be like this. 0 Next TopicJava-instant-getlong-method |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India