谢谢你们的帮助,对不起,对这个东西还是新手。想通了
这是我的代码
f <$> x = pure f <*> x
我收到错误消息
//Example that illustrates use of methods
public class FirstMethod
{
//The entry point
public void main(String[] args)
{
//declare two integer variables
int firstNum = 87;
int secondNum = 68;
//Creating an object of the class
FirstMethod callMethod = new FirstMethod();
//invoking the method
System.out.println("The result is " +
calculateSum(firstNum,secondNum));
}
//creating the method.
static int calculateSum(int first,int second)
{
int sum = first + second;
return sum;
}
}
但我不想做静态方法。 请帮助是否有东西没有看到。我是新编码
答案 0 :(得分:0)
There 'static' keyword was missing in main method, Please try this
public class FirstMethod
{
//The entry point
public static void main(String[] args)
{
//declare two integer variables
int firstNum = 87;
int secondNum = 68;
//Creating an object of the class
FirstMethod callMethod = new FirstMethod();
//invoking the method
System.out.println("The result is " +
calculateSum(firstNum,secondNum));
}
//creating the method.
static int calculateSum(int first,int second)
{
int sum = first + second;
return sum;
}
}
答案 1 :(得分:0)
简单地说,你不能。 main方法必须是静态的,因为它在创建任何对象之前被调用但是JVM。请参阅this回答。 希望有所帮助。