我正在尝试在 java 中的 main 方法中创建方法,但是当我尝试启动新方法时,每行都会出现错误“Illegal start of statement”。这是我的程序。
导入 java.util.*;导入java.lang.Math;
公共类circlerisk {
final static double PI = 3.14156;
public static void main(String [] args)
{
double x1;
double y1;
double x2;
double y2;
double radius;
double circumference;
double area;
Scanner console = new Scanner(System.in);
System.out.println("Please enter x1");
x1 = console.nextDouble();
System.out.println("Please enter y1");
y1 = console.nextDouble();
System.out.println("Please enter x2");
x2 = console.nextDouble();
System.out.println("Please enter y2");
y2 = console.nextDouble();
public static double distance(double x1, double y1, double x2, double y2)
{
double dx,dy,d;
dx = x2 - x1;
dy = y2 - y1;
d = Math.sqrt(dx*dx+dy*dy);
return d;
}//distance
public static double radius(double x1, double y1, double x2, double y2)
{
radius = d;
return radius;
}
public static double circumference(double radius)
{
circumference = (radius*2*PI);
return circumference;
}
public static double area(double radius;)
{
area = (radius*radius*PI);
return area;
}
}//main
}//班级