Question

How would I convert the equation for the distance between two points:

sqrt((x2 − x1)^2 + (y2 − y1)^2) 

into proper Java code?

Was it helpful?

Solution

You can use Math.pow and Math.sqrt of package java.lang.Math

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top