OffsetTime toString() method in Java with examples Last Updated : 31 Dec, 2018 Summarize Comments Improve Suggest changes Share Like Article Like Report The toString() method of OffsetTime class in Java outputs this date as a String, such as "11:25:10+11:10" for an example. Syntax : public String toString() Parameter: This method does not accepts any parameter. Return Value: It returns a string representation of this date, not null. Below programs illustrate the toString() method: Java // Java program to demonstrate the toString() method import java.time.OffsetTime; public class GFG { public static void main(String[] args) { // Gets the current time OffsetTime time = OffsetTime.now(); // Gets the local time System.out.println("Local-time in string format: " + time.toString()); } } Output: Local-time in string format: 04:04:24.595Z Reference: https://docs.oracle.com/javase/8/docs/api/java/time/OffsetTime.html#toString-- Comment More infoAdvertise with us Next Article String toString() Method in java with Examples G gopaldave Follow Improve Article Tags : Java Java-Functions Java-time package Java-OffsetTime Practice Tags : Java Similar Reads String toString() Method in java with Examples String toString() is the built-in method of java.lang which return itself a string. So here no actual conversion is performed. Since toString() method simply returns the current string without any changes, there is no need to call the string explicitly, it is usually called implicitly. Syntax : publ 1 min read Modifiers toString() method in Java with Examples The toString() method of java.lang.reflect.Modifier class is used to get a string representing the access modifier flags in the specified modifier. we have to pass int value as a parameter to get access modifier names. Syntax: public static String toString(int mod)Parameters: This method accepts one 2 min read OffsetTime parse() method in Java with examples In OffsetTime class, there are two types of parse() method depending upon the parameters passed to it. parse(CharSequence text) parse() method of a OffsetTime class used to get an instance of OffsetTime from a string such as '15:25:10+01:00' passed as parameter.The string must have a valid date-time 2 min read Stack toString() method in Java with Example The toString() method of Java Stack is used to return a string representation of the elements of the Collection. The String representation comprises a set representation of the elements of the Collection in the order they are picked by the iterator closed in square brackets[].This method is used mai 2 min read Optional toString() method in Java with examples The toString() method of java.util.Optional class in Java is used to get the string representation of this Optional instance. Syntax: public String toString() Parameters: This method accepts nothing. Return value: This method returns the string representation of this Optional instance. Below program 1 min read ShortBuffer toString() method in Java with Examples The toString() method in java.nio.ShortBuffer is used to return a string summarizing the state of this buffer. Syntax: public String toString() Return Value:The method returns a summary string. Below are the examples to illustrate the toString() method: Program 1: Java // Java program to demonstrate 1 min read Like