Click here to watch on Youtube:
https://www.youtube.com/watch?v=hCUem4juxiI&list=UUhwKlOVR041tngjerWxVccw
CalendarDemo.java
Output
Click the below link to download the code:
https://sites.google.com/site/ramj2eev2/java_basics/CalendarDemo_set.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava_2018/CalendarDemo_set
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/fcab7bc6a80f12c850b8ccc28d71601c94666bbb/BasicJava_2018/CalendarDemo_set/?at=master
See also:
All JavaEE Videos Playlist
All JavaEE Videos
All JAVA EE Links
Spring Tutorial
Servlets Tutorial
All Design Patterns Links
JDBC Tutorial
Java Collection Framework Tutorial
JAVA Tutorial
Kids Tutorial
Cooking Tutorial
https://www.youtube.com/watch?v=hCUem4juxiI&list=UUhwKlOVR041tngjerWxVccw
CalendarDemo.java
import java.util.Calendar;
public class CalendarDemo
{
public static void main(String[] args)
{
Calendar cal = Calendar.getInstance();
System.out.println("Current year is = " + cal.get(Calendar.YEAR));
System.out.println("Current Month is = " + cal.get(Calendar.MONTH));
/*
* Parameters:
*
* field - the given calendar field.
*
* value - the value to be set for the given calendar field.
*/
cal.set(Calendar.YEAR, 2013);
cal.set(Calendar.MONTH, 5);
System.out.println("\nAltered year is = " + cal.get(Calendar.YEAR));
System.out.println("Altered Month is = " + cal.get(Calendar.MONTH));
}
}
public class CalendarDemo
{
public static void main(String[] args)
{
Calendar cal = Calendar.getInstance();
System.out.println("Current year is = " + cal.get(Calendar.YEAR));
System.out.println("Current Month is = " + cal.get(Calendar.MONTH));
/*
* Parameters:
*
* field - the given calendar field.
*
* value - the value to be set for the given calendar field.
*/
cal.set(Calendar.YEAR, 2013);
cal.set(Calendar.MONTH, 5);
System.out.println("\nAltered year is = " + cal.get(Calendar.YEAR));
System.out.println("Altered Month is = " + cal.get(Calendar.MONTH));
}
}
Output
Current year is = 2018
Current Month is = 5
Altered year is = 2013
Altered Month is = 5
Current Month is = 5
Altered year is = 2013
Altered Month is = 5
Click the below link to download the code:
https://sites.google.com/site/ramj2eev2/java_basics/CalendarDemo_set.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava_2018/CalendarDemo_set
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/fcab7bc6a80f12c850b8ccc28d71601c94666bbb/BasicJava_2018/CalendarDemo_set/?at=master
See also:
No comments:
Post a Comment