简单的计算过程出错

时间:2017-06-17 02:47:24

标签: java

我正在尝试计算:x(t) = 0.5at^2 + vit + xi

package javaapplication1;
import java.io.*;

public class JavaApplication1 {


public static void main(String[] args){

double  gravity =-9.81; // Earth's gravity in m/s^2

double  initialVelocity = 0.0; // starting velocity of the object

double  fallingTime = 10.0; // time in seconds that the object falls

double  initialPosition = 1000.0; // Starting position in meters, the calculation will      determine the ending position in meters

double  finalPosition = 0.0;

System.out.println("The object's position after " + fallingTime +" seconds is           "+finalPosition + " m.");

}
}

我遇到错误,无法找到波纹管错误的解决方案:

Error: Main method not found in class javaapplication1.JavaApplication1, please define the main method as:
   public static void main(String[] args)
or a JavaFX application class must extend javafx.application.Application
/Users/mac/Library/Caches/NetBeans/8.2/executor-snippets/run.xml:53: Java returned: 1
BUILD FAILED (total time: 0 seconds)

我尝试将static添加到public class GravityCalculator

正如这个问题所解释的那样:

https://stackoverflow.com/questions/6440010/modifier-static-is-only-allowed-in-constant-variable-declarations 

但我仍然有同样的错误。是因为找不到run.xml文件还是我的代码中出现了sytax错误?

请帮帮我,这是我在java中的第一个代码。

0 个答案:

没有答案