Year toString()
outputs this year as a String.
toString
has the following syntax.
public String toString()
The following example shows how to use toString
.
import java.time.Year; // w w w . ja v a2s . c o m public class Main { public static void main(String[] args) { Year y = Year.of(2014); System.out.println(y.toString()); } }
The code above generates the following result.