当前位置: 技术问答>java相关
这个错误是什么意思,我改了半天还是这个错。
来源: 互联网 发布时间:2015-02-20
本文导语: 我用PlayListTester检测PlayList类,编译通过,但是每次都有下面的错误: Exception in thread "main"java.lang.negativeArraySizeException at PlayList.(PlayList.java:8) at PlayListTester.main(PlayListTester.j...
我用PlayListTester检测PlayList类,编译通过,但是每次都有下面的错误:
Exception in thread "main"java.lang.negativeArraySizeException
at PlayList.(PlayList.java:8)
at PlayListTester.main(PlayListTester.java:10)
数组哪里错拉,我找不出来,下面是两个类
请大家指点,十分感谢!
public class PlayList
{
int numberOfSong=0;
int capacity;
String songArtistTitle;
PlayList[] list=new PlayList[capacity-1];
public PlayList(int capacityIn)
{
capacity=capacityIn;
}
public PlayList(String songArtistTitleIn)
{
if (songArtistTitleIn.length() =0 && numberOfSong
Exception in thread "main"java.lang.negativeArraySizeException
at PlayList.(PlayList.java:8)
at PlayListTester.main(PlayListTester.java:10)
数组哪里错拉,我找不出来,下面是两个类
请大家指点,十分感谢!
public class PlayList
{
int numberOfSong=0;
int capacity;
String songArtistTitle;
PlayList[] list=new PlayList[capacity-1];
public PlayList(int capacityIn)
{
capacity=capacityIn;
}
public PlayList(String songArtistTitleIn)
{
if (songArtistTitleIn.length() =0 && numberOfSong