Specifications

Sun Services
Java™ Programming Language
Module 6, slide 39 of 43
Copyright 2005 Sun Microsystems, Inc. All Rights Reserved. Sun Services, Revision F
An equals Example
17
18 System.out.println("set date2 = date1;");
19 date2 = date1;
20
21 if ( date1 == date2 ) {
22 System.out.println("date1 is identical to date2");
23 } else {
24 System.out.println("date1 is not identical to date2");
25 }
26 }
27 }
This example generates the following output:
date1 is not identical to date2
date1 is equal to date2
set date2 = date1;
date1 is identical to date2