0

Java: What is wrong?

I am not sure why this is throwing errors, mostly pertaining to } missing... public class Program { public static void main(String[] args) { String[][] job = {{"Paladin", "Sentry", "Warden"}, {"Squire", "Archer", "Monk"}, {"Cleric", "Shaman", "Prophet"}{"Witch", "Alchemist", "sorcerer"}}; System.out.println(job[2][3]); } }

16th Feb 2018, 10:46 AM
Nathan Lewis
Nathan Lewis - avatar
2 ответов
+ 1
indexes of arrays start with 0 not with 1. I guess that's your error. You try to access an element which doesn't exist
16th Feb 2018, 11:00 AM
Alex
Alex - avatar
+ 1
I was thinking about excel again.. thank you. I also just noticed I am missing a comma between 2 arrays
16th Feb 2018, 11:02 AM
Nathan Lewis
Nathan Lewis - avatar