C++ 中的“Hello world”练习抛出 ArrayIndexOutOfBoundsException

问题描述

我的教科书显示了这段 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++ 项目,然后单击“关闭其他人...” 然后你就可以做正确的事了。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...