Fortune Telling Collection - Comprehensive fortune-telling - JAVA topic, seek solution, seek code! ! ! !

JAVA topic, seek solution, seek code! ! ! !

Public? Class? Point? {

Private? Double? x,? y;

Public? Point (double? x,? Double? y){

This. x? =? x;

This. y? =? y;

}

Public? Double? Distance (point? p){

Return? Math.sqrt((p.x? -? x)? *? (p.x? -? x)? +? (p.y? -? y)? *? (p.y? -? y));

}

Public? String? toString(){

Return? "("? +? x? +",?" +? y? +")";

}

/**

? *? @param? A parameter name

? */

Public? Static electricity Invalid? main(String[]? args)? {

//? Todo? Automatically generated? Method? cigarette end

Point? p 1? =? New? Point (3,? 4);

Point? p2? =? New? Point (5,? 6);

System.out.println("The? Distance? Between? Point? ”? +? p 1? +? "? then what ”+? p2? +? "? Is it? ”? +? P 1. distance (p2)? +? ".");

}

}