3 / 3
Dec 2009

im new, and trying to submit my first solution, to the PRIME1 problem. i keep getting a "compilation problem".
here is the solution i have submitted:


import java.util.Collections;
import java.util.LinkedList;
import java.util.Scanner;
public class Main
{
public static void main (String[]args)
{
Scanner input=new Scanner (System.in);
int f=input.nextInt();
int[]a=new int[f];
int[]b=new int[f];
for(int j=0; j {
int m=input.nextInt();
int n=input.nextInt();
a[j]=m;
b[j]=n;
}
for(int j=0; j Listlst=new List();
lst.insert(null, 2);
Nodepos=lst.getFirst();
for(int i=3; i while(pos.getNext()!=null&&i%pos.getInfo()!=0)
{
pos=pos.getNext();
}
if (pos.getNext()==null){
Nodepos1=new Node(i);
pos.setNext(pos1);
}
pos=lst.getFirst();
}
while(pos!=null){
if(pos.getInfo()>=a[j])
System.out.println(pos.getInfo());
pos=pos.getNext();
}
System.out.println();
}
}
}


and here is the errors page:

/sources/Main.java:20: cannot find symbol
symbol : class List
location: class Main
Listlst=new List();
^
/sources/Main.java:20: cannot find symbol
symbol : class List
location: class Main
Listlst=new List();
^
/sources/Main.java:22: cannot find symbol
symbol : class Node
location: class Main
Nodepos=lst.getFirst();
^
/sources/Main.java:29: cannot find symbol
symbol : class Node
location: class Main
Nodepos1=new Node(i);
^
/sources/Main.java:29: cannot find symbol
symbol : class Node
location: class Main
Nodepos1=new Node(i);
^
5 errors


the problem probably lies in the classes importation, but i can't figure it out.
can someone please help me?
thanks

  • created

    Dec '09
  • last reply

    Dec '09
  • 2

    replies

  • 285

    views

  • 2

    users

i would like to add that the problem is obviously with the lists. i'm not using them right, and probably i'm importing them in a wrong way.

You should be getting exactly the same compile error when compiling locally; it is nothing to do with submitting to the judge. The error messages tell you pretty clearly what the error is; if you don't understand them, you should read up on the Java language.

The first and second error message tells you it doesn't understand what 'List' is. That is because you haven't imported it anywhere. You've imported java.util.LinkedList, and not java.util.List. Of course, even if you did import List, it is an abstract class and can't be instantiated. I presume you were wanting to use a LinkedList, so use a LinkedList.

The other messages tell you it doesn't understand what 'Node' is, because you haven't defined the Node class anywhere in your program.

Suggested Topics

Want to read more? Browse other topics in JAVA based languages or view latest topics.