选择不包含java eclipse中的主类型错误。 [英] Selection does not contain a main type error in java eclipse.

查看:682
本文介绍了选择不包含java eclipse中的主类型错误。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试修复此代码以返回最小值,但我不断收到此错误。 Java Eclipse中的选择不包含主类型错误。







公共类MinimumValue {



public static int main(int [] arrayOfInts,int n){

int currmin = 100;

for(int i = 0; i< n; i ++){

if(arrayOfInts [i]> currmin)

currmin = arrayOfInts [i];

System.out.println(i);

}

返回currmin;

}

}



我尝试了什么:



我试过配置构建路径指向正确的文件,但我仍然收到此错误,任何提示?

I am trying to fix this code to return the minimum value, but i keep getting this error. "Selection does not contain a main type" error in Java Eclipse.



public class MinimumValue{

public static int main(int[] arrayOfInts, int n) {
int currmin = 100;
for (int i = 0; i < n; i++) {
if (arrayOfInts[i] > currmin)
currmin = arrayOfInts[i];
System.out.println(i);
}
return currmin;
}
}

What I have tried:

I tried configuring the build path to point to the correct file but I am still getting this error, any tips?

推荐答案

您的主要方法未正确定义。请参阅课程:仔细查看Hello World!应用程序(Java™教程>入门) [ ^ ]。
Your main method is not defined correctly. See Lesson: A Closer Look at the "Hello World!" Application (The Java™ Tutorials > Getting Started)[^].


这篇关于选择不包含java eclipse中的主类型错误。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆