In this section, you will learn how to obtain the current year. The Calendar class provides a getInstance() method that returns a Calendar object. The method cal.get(Calendar.YEAR) will return the current year.
Here is the code of GetYear.java
Output will be displayed as:
We have 1000s of tutorials on our website. Search Tutorials tutorials on our website.
Posted on: November 1, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles