jcreator中的Begginer错误! [英] Begginer error in jcreator !

查看:85
本文介绍了jcreator中的Begginer错误!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好!我很难用我老师的书中的代码。

在代码中我必须显示除数。

我收到此错误:

Hello! I am having an hard time with a code from my teacher book.
In the Code I must display the divisors.
I get this error:

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at Display.main(afisare.java:7)





我真的是令人沮丧,你能帮帮我吗?这里代码:



I am really frustrating , can you help me ? Here code:

class Display
{
public static void main(String args[ ] )
{
 	int nr=Integer.parseInt(args[0]);
 	int i;
for (i=1; i<=nr; i++)
if (nr%i==0)
System.out.println(i);
}// main
}// class









对不起我的英语,我来自中欧。



我尝试过:



我真的不知道为什么我会收到这个错误,有人可以解释我,请你!





Sorry My English , I am from Middle Europe.

What I have tried:

I really dont know why I get this error , can someone explain me , pleaseee !

推荐答案

Ty改变你的代码来自

Ty changing your code from
public static void main(String args[ ] )



to


to

public static void main(String[] args)



这应解决问题。


That should solve the problem.


这篇关于jcreator中的Begginer错误!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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