Skip to content

Vector Error #1

@KingzShady

Description

@KingzShady

The error "Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 3" occurs because the program is trying to access an element of an array that does not exist. Specifically, the error occurs in the line "graphics2D.drawLine(nodeCoords[node1].x, nodeCoords[node1].y, nodeCoords[node2].x, nodeCoords[node2].y);" when the value of the variable "i" is equal to "numNodes - 1", causing the variable "node2" to be equal to "shortestRoute[numNodes - 1]" which is an invalid index.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions