I have the following code:
public static void main(String[] args) {
try {
String[] studentnames = {
/* this is an array of 9000 strin
Initialising the studentnames array is counting towards the size of the main method. As there are 9000 student names each name can only be about 7 characters before you'll run out of space. As the others have stated you need to reduce the size of method. You can split it into pieces as Pramod said but in this case the bulk of the method is actually data. I would do as Infiltrator says and split the names out into a separate file and just read it in your main. Something like commons-io can be used to get you to effectively the same position you're starting in.
List namelist = FileUtils.readLines(new File("studentnames.txt"));
String[] studentnames = namelist.toArray(new String[0]);
You may find it useful to process the list rather than convert it to an array or alternatively you could use a LineIterator instead
LineIterator it = FileUtils.lineIterator(file);
try {
while (it.hasNext()) {
String line = it.nextLine();
// do something with line
}
} finally {
it.close();
}