问题描述
我的教科书显示了这段 C++ 代码可以运行,但是当我在 net beans 上运行它时,它显示此错误 Exception in thread "main" Arrayindexoutofboundsexception: 0
#include <iostream>
using namespace std;
int main(void)
{
cout << "Hello world";
return 0;
}
解决方法
在 C++ 中没有 java.lang.ArrayIndexOutOfBoundsException
那个错误是因为 netbeans 正在运行另一个 Java 项目。
右键单击 c++ 项目,然后单击“关闭其他人...” 然后你就可以做正确的事了。