ComparisonExample

From ggc

Jump to: navigation, search

01 
02 import java.awt.geom.*;
03 
04 /**
05  * All about my application here.
06  @author Jam Jenkins
07  */
08 public class ComparisonExample
09 {
10   public static void main(String[] args)
11   {
12     int x=6;
13     int y=6;
14     Point2D.Double pointA;
15     pointA=new Point2D.Double(x, y);
16     Point2D.Double pointB;
17     pointB=new Point2D.Double(x+1, y);
18     pointB=pointA;
19     pointA.x=10;
20     System.out.println("x of pointB is "+pointB.x);
21     System.out.println("x of pointA is "+pointA.x);
22 
23     if(pointA==pointB)
24       System.out.println("Same Memory Location");
25     else
26       System.out.println("Different Memory Location");
27     if(pointA.equals(pointB))
28       System.out.println("Same Memory Contents");
29     else
30       System.out.println("Different Memory Contents");
31 
32   }
33 }


Download/View ComparisonExample.java





Views
Personal tools
Add to 
del.icio.usAdd to 
diggAdd to 
FacebookAdd to 
favoritesAdd to 
GoogleAdd to 
MySpaceAdd to 
PrintAdd to 
SlashdotAdd to 
StumbleUponAdd to 
Twitter