In this example, we have shared how to get current year in Java. Use the following code to get the current year.
1 2 | // Get current year in Java. int year = Calendar.getInstance().get(Calendar.YEAR); |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.