# Distance between two points

• 5
• Locked
You're aware that you can draw a straight line between any two points in a plane, right? Probably, but if not, check out Euclid and his treatise called "Elements". Better yet, take this assertion on faith and write a static double getDistance(x1, y1, x2, y2) method. It should calculate the distance between two points.
You can't complete this task, because you're not signed in.
Aron
Level 18
8 July 2021, 20:53
under 5 min video, explaining how to calculate distance
Angelo Tratsis
Level 8 , Boston, United States
26 April 2021, 18:15
Usman Full Stack Developer at QA
1 July 2021, 16:19
you legend, saved me the hassle of googling :D
Karas Java Developer
1 September 2020, 22:47
Okay... wait... wait.... we are here to learn java, not quadratic mathematics. https://www.mathwarehouse.com/algebra/distance_formula/index.php Pythagorean Theorem in simple terms
Nastya
Level 19 , Moscow, Russia
7 May 2020, 17:03
Martzehh
2 June 2020, 18:46
Thank you!!
Khongpak Phupkdee
Level 15 , Chiangrai, Thailand
15 March 2021, 15:05
Thank you
Nickolas Johnson
Level 8 , St. Louis, United States of America
13 March 2020, 15:29
Mathisfun.com completely screwed me on this one. I thought i was using the right formula but i guess not.
Tonatiuh
Level 12 , Mexico, Mexico
19 October 2019, 18:01
Java does not have an exponent operator like some other languages. A common mistake is to assume 3^2 is 3 to the 2nd power. It is not. The caret ^ is a valid operator in Java (and similar languages), but it is binary XOR.