Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java SE 综合讨论区 » 安装/配置/编译/环境  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 Re:新手求教:Exception in thread "main" java.lang.NoSuchMethodError: main [Re:lxy0618]
mtdhwgij





发贴: 13
积分: 0
于 2006-05-19 22:42 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
同楼主,我也出现了同一个问题,即使是个简单的hello,world!也出现这种线程错误,现将错误提示输出:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at Search.main(Search.java:13)
Press any key to continue...
这是源程序:

public class Search
{
  static int linearSearch(int a[],int key)
{
  for (int n=0;n<a.length;n++)
if (a[n]==key) return n;
return-1;
}
public static void main(String args[])
{
  int a[]={25,36,47,32,21,16};
int key=Integer.parseInt(args[0]);
int k=linearSearch (a,key);
if (k!=-1)
System.out.println("Found value in element"+k);
else
System.out.println("key"+key+"nou found");
}
}
使用的是JCreator软件同楼主




Eclipse使用技巧

话题树型展开
人气 标题 作者 字数 发贴时间
36195 新手求教:Exception in thread "main" java.lang.NoSuchMethodError: main lxy0618 474 2006-03-29 08:54
34099 Re:新手求教:Exception in thread "main" java.lang.NoSuchMethodError: main JavaandC 537 2006-03-29 09:37
33448 Re:新手求教:Exception in thread "main" java.lang.NoSuchMethodError: main mtdhwgij 286 2006-05-19 22:45
33348 Re:新手求教:Exception in thread "main" java.lang.NoSuchMethodError: main zcjl 56 2006-05-19 23:54
33425 Re:新手求教:Exception in thread "main" java.lang.NoSuchMethodError: main mtdhwgij 19 2006-05-20 21:20
33228 Re:新手求教:Exception in thread "main" java.lang.NoSuchMethodError: main JavaandC 222 2006-05-21 09:12
33556 Re:新手求教:Exception in thread "main" java.lang.NoSuchMethodError: main xuyan268 34 2006-05-21 21:59
33736 Re:新手求教:Exception in thread "main" java.lang.NoSuchMethodError: main 心情跑车 11 2006-05-31 16:25
34160 Re:新手求教:Exception in thread "main" java.lang.NoSuchMethodError: main lxy0618 102 2006-03-29 13:27
33953 Re:新手求教:Exception in thread "main" java.lang.NoSuchMethodError: main JavaandC 108 2006-03-29 13:41
33932 Re:新手求教:Exception in thread "main" java.lang.NoSuchMethodError: main 朱批 36 2006-03-29 17:42
34243 Re:新手求教:Exception in thread "main" java.lang.NoSuchMethodError: main 莫言 68 2006-04-14 18:12
33832 Re:新手求教:Exception in thread "main" java.lang.NoSuchMethodError: main sunjavaduke 164 2006-04-30 11:15
33625 Re:新手求教:Exception in thread "main" java.lang.NoSuchMethodError: main kennye 49 2006-05-16 15:02
33537 Re:新手求教:Exception in thread "main" java.lang.NoSuchMethodError: main why 191 2006-05-17 01:45
33389 Re:新手求教:Exception in thread "main" java.lang.NoSuchMethodError: main mtdhwgij 671 2006-05-19 22:42

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923