登陆

我出现数组越界,该怎么解决

报错的提示如下

Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 20 at org.liky.game.frame.FiveChessFrame.checkCount(FiveChessFrame.java:280) at org.liky.game.frame.FiveChessFrame.checkwin(FiveChessFrame.java:183) at org.liky.game.frame.FiveChessFrame.mousePressed(FiveChessFrame.java:141) at java.desktop/java.awt.Component.processMouseEvent(Component.java:6611) at java.desktop/java.awt.Component.processEvent(Component.java:6379) at java.desktop/java.awt.Container.processEvent(Container.java:2263) at java.desktop/java.awt.Window.processEvent(Window.java:2046) at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4990) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321) at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2769) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4822) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715) at java.base/java.security.AccessController.doPrivileged(AccessController.java:391) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95) at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745) at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743) at java.base/java.security.AccessController.doPrivileged(AccessController.java:391) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

# Java
Jesse·BryantJesse·Bryant22 天前149 次浏览

全部回复(1)我要回复

  • 逆旅行人

    逆旅行人2022-01-03 11:01:54

    数组越界了,看一下你的条件,访问的是不是数组内的数据

    回复
    0
  • 取消回复发送