Java运行中出现数组下标越界什么意思

来源:百度知道 编辑:UC知道 时间:2024/06/06 13:36:38
我是初学者,这是一道作业题,刚学到for,不知道哪里出了错,请高人指点!!
import javax.swing.JOptionPane;

public class TutorialCertificate {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {

String s1 =JOptionPane.showInputDialog("Bitte geben Sie die erste note ein");
String s2 =JOptionPane.showInputDialog("Bitte geben Sie die zweite note ein");
String s3 =JOptionPane.showInputDialog("Bitte geben Sie die dritte note ein");
String s4 =JOptionPane.showInputDialog("Bitte geben Sie die vierte note ein");
String s5 =JOptionPane.showInputDialog("Bitte geben Sie die fuefte note ein");
String s6 =JOptionPane.showInputDialog("Bitte geben Sie die sechste note ein");
String s7 =JOptionPane.showInputDialog("Bitte geben Sie die siebte note ein");
String s8 =JOptionPane.showInputDialog("Bitte geben Sie die achte note ein&q

比如你定义一个String [] a = String [10];当然这样写 string [10] = ....,就出错了,你定义数据长度为10,而 java的数组下标是从0开始算的

说明你数组的长度没有达到你写的那个数组的长度