Javatpoint Logo
Javatpoint Logo

Java Calendar toString() Method

The toString() method of Calendar class returns a string representation of the current object. This is the method of object class which is supreme of all the other classes in java.

Syntax

Parameter

Does not have any parameter.

Returns

String representation of the current calendar.

Throws

Does not throw Exception.

Example 1

Test it Now

Output:

Past calendar : Sat Aug 18 12:27:55 PDT 2018
calendar after using toString() : (String representation of calobject)

Example 2

Test it Now

Output:

cal Sat Aug 18 12:32:36 PDT 2018
cal.toString() : (String representation of calobject)




Help Others, Please Share

facebook twitter pinterest