Actually Go is really cool! It is more concise… compared to Java…
Java public class Circle { private double x, y, r; public double getX() { return x; } public void setX(double x) { this.x = x; } public double getY() { return y; } public void setY(double y) { this.y = y; } public double getR() { return r; } public void setR(double r) { this.r = r; }
}
public double area() { return Math.PI * r * r; }
Go import “math” type Circle struct { X, Y, R float64 } func (c *Circle) Area() float64 { return math.Pi * c.R * c.R }