Click here to watch on Youtube:
https://www.youtube.com/watch?v=u2lIi3Bb7yo&list=UUhwKlOVR041tngjerWxVccw
GregorianCalendarDemo.java
Output
Click the below link to download the code:
https://sites.google.com/site/ramj2eev2/java_basics/GregorianCalendarDemo-equals.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava_2018/GregorianCalendarDemo-equals
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/4cfac93378c4f9d33f18bb5083115d18778294de/BasicJava_2018/GregorianCalendarDemo-equals/?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=u2lIi3Bb7yo&list=UUhwKlOVR041tngjerWxVccw
GregorianCalendarDemo.java
import java.util.GregorianCalendar;
public class GregorianCalendarDemo
{
public static void main(String[] args)
{
GregorianCalendar cal1 = (GregorianCalendar) GregorianCalendar
.getInstance();
System.out.println("cal1 = "+cal1.getTime());
GregorianCalendar cal2 = (GregorianCalendar) cal1.clone();
System.out.println("cal2 = "+cal1.getTime());
/*
* Parameters:
*
* obj - the object to compare with.
*
* Returns:true if this object is equal to obj; false
* otherwise.
*/
// compare the two calendars
System.out.println("cal1 and cal2 are equal = " + cal1.equals(cal2));
}
}
public class GregorianCalendarDemo
{
public static void main(String[] args)
{
GregorianCalendar cal1 = (GregorianCalendar) GregorianCalendar
.getInstance();
System.out.println("cal1 = "+cal1.getTime());
GregorianCalendar cal2 = (GregorianCalendar) cal1.clone();
System.out.println("cal2 = "+cal1.getTime());
/*
* Parameters:
*
* obj - the object to compare with.
*
* Returns:true if this object is equal to obj; false
* otherwise.
*/
// compare the two calendars
System.out.println("cal1 and cal2 are equal = " + cal1.equals(cal2));
}
}
Output
cal1 = Thu Oct 11 09:02:24 IST 2018
cal2 = Thu Oct 11 09:02:24 IST 2018
cal1 and cal2 are equal = true
cal2 = Thu Oct 11 09:02:24 IST 2018
cal1 and cal2 are equal = true
Click the below link to download the code:
https://sites.google.com/site/ramj2eev2/java_basics/GregorianCalendarDemo-equals.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava_2018/GregorianCalendarDemo-equals
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/4cfac93378c4f9d33f18bb5083115d18778294de/BasicJava_2018/GregorianCalendarDemo-equals/?at=master
See also:
No comments:
Post a Comment