// Store this program in file program1.java. In the same directory, create // another directory Geometry in which you store Point.java, Triangle.java. // This forms the package Geometry. // Note that you can't access x attribute of P directly by P.x // since the attribute x in class Point is declared as "double x". // So it is visible only with in the classes of // package Geometry. For example it is possible to directly access // attribute of a point in some method of Triangle.java. //--------------------------------------------------------------------------- //Try out the following exercises : //1. Replace the 2nd statement in the following program by // "double x = P.x". Now try to compile the program. Give reason for the // compilation error. //2. declare x as "public double x" in Point.java. Replace the 2nd statement // in the following program with "double d = P.x". // Now try to comiple and run this program. //--------------------------------------------------------------------------- import Geometry.Point; class program1 { public static void main(String args[]) { Point P = new Point(1,2); double d = P.getX(); Point Q = new Point(); System.out.println(d); } }