+91-85006-22255
Write a program to get the area of a triangle.
[0, 0], [5, 0], [5, 5]
[-7, 0], [3, 0], [3, 10]
[2, 2], [6, 2], [6, 6]
[3, 1], [1.5, 1.2], [2.5, 4.3]
[-2, 0], [1, 0], [0, -3]
class AreaOfATriangle { public static void main(String s[]) { Point firstPoint = new Point(0, 0); Point secondPoint = new Point(5, 0); Point thirdPoint = new Point(5, 5); System.out.println("Area of a triangle : " + areaOfATriangle(firstPoint, secondPoint, thirdPoint)); } public static double areaOfATriangle(Point firstPoint, Point secondPoint, Point thirdPoint) {
}
} class Point { double x; double y; Point(double x, double y) { this.x = x; this.y = y; } }
Topic: Java Multiple Methods In One Class
Read this topic Take test on this topic
Open In App