这样一个程序 public class temp { public static void main(String args[]) { int c=1,d=4; int e=add(c+d); } public static int add(int a,int b) { return (a+b); } } 出错信息 temp.java:6: 在 temp 中的 add(int,int) 不能被应用到 (int) int e=add(c+d); ^ 1 个错误
你的add方法有两int型参数 而调用时只传了一个参数c+d,当然要报错! 应该是: int e=add(c,d);
public class temp
{
public static void main(String args[])
{
int c=1,d=4;
int e=add(c+d);
}
public static int add(int a,int b)
{
return (a+b);
}
}
出错信息
temp.java:6: 在 temp 中的 add(int,int) 不能被应用到 (int)
int e=add(c+d);
^
1 个错误
而调用时只传了一个参数c+d,当然要报错!
应该是:
int e=add(c,d);
访问http://168.168.18.11:81/etechbase/advsearch.php将您的问题输入查询内容框,选择不同的精确程度,即可以找到你所需要的答案。效果还是可以的。