The import pro. Point. S;
The class point {
Double x, y;
Point () {}
Point (double x, double y) {
this.x=x;
this.y=y; }
Void the show () {
System. The out. Println (" (" + x + ", "+ y +") ");
}
Static class s {
Point p1, p2,
Double s;
S () {}
S (point p1, point p2) {
This. P1=p; This. P2=p2;
S=Math. SQRT ((p1) X-ray p2) x) * (p1) X-ray p2) x)
+ (p1) y - p2) y) * (p1) y - p2) y));
}
Void the show () {System. Out. Println (s); }
}
}
Public class dian {
Public static void main (String [] args) {
S s1=new (s);
Point p=new point (2, 3);
Point p2=new point (2, 5);
P1. The show ();
P2. The show ();
S1. The show ();
}
}
CodePudding user response:
S s1=new (s); This line of code in p1 and p2 instantiated, s1. The show () before,