Page 1 of 1

Class names error

Posted: Thu May 10, 2012 3:57 am
by cchris
Hi, i'm getting this error in textpad whenever I compile my program.
error: Class names, 'uncheked', are only accepted if annotation processing is explicitly requested


/*
Chris#02
Date: 12/6/2011
Description: Lesson 25 project
*/
import java.util.*;
import java.io.*;

class AlphNames
{
public static void main( String args[ ] ) throws IOException
{
System.out.println("Chris #02\n");
Scanner sf = new Scanner(new File("U:\\My Documents\\Computer Science I - Student Folders\\Lesson25\\Names.in"));

int maxIndx = -1;
String text[] = new String[1000];
while(sf.hasNext())
{
maxIndx++;
text[maxIndx] = sf.nextLine();
//System.out.println(text[maxIndx]);//for testing
}
String reversedNames[] = new String [maxIndx+1];
for(int x=0; x<=maxIndx; x++)
{
Scanner sc = new Scanner(text[x]);
String fN = sc.next(), lN = sc.next();
reversedNames[x] = lN + ", " +fN;
}
Arrays.sort(reversedNames);
for(int x=0; x<=maxIndx; x++)
System.out.println(reversedNames[x]);


}// end of main()
}//end of class


I'm not sure why I am getting this error. I saved this as AlphNames.java, but i'm still getting the error.

Posted: Thu May 10, 2012 11:27 am
by MudGuard
Which JDK version are you using?

The class compiles without problem in JDK 1.6.0_32

Posted: Thu May 10, 2012 12:03 pm
by ben_josephs
What is uncheked? It doesn't appear in your program.

What command are you running. It should be javac AlphNames.java (note: not javac AlphNames).