Funny Compile Error
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Debin_Gao
Posted On:   Sunday, August 26, 2001 08:41 AM

Hi, I have a java source code here (see below) which can compile on any other machine. However, it gives me an error when compiled on my notebook computer. The error is as follows: DetectPrime.java:19: cannot resolve symbol symbol:method parseInt (java.lang.String) location:class Integer x=Integer.parseInt(s); ^ 1 error I tried reinstall the Java SDK 1.3, but this error never runs away. Can anyone suggest me a way out? BTW, I am using Windows ME. Thanks a lot for your time. The source code is as follows: import java.io.*; import java.lang.*; class DetectPrime    More>>

Hi,


I have a java source code here (see below) which can compile on any other machine. However, it gives me an error when compiled on my notebook computer. The error is as follows:


DetectPrime.java:19: cannot resolve symbol

symbol:method parseInt (java.lang.String)

location:class Integer
x=Integer.parseInt(s);

^
1 error



I tried reinstall the Java SDK 1.3, but this error never runs away. Can anyone suggest me a way out?



BTW, I am using Windows ME.



Thanks a lot for your time. The source code is as follows:



import java.io.*;

import java.lang.*;

class DetectPrime

{

public static void main (String args[] ) throws IOException {



//Variable Declarations

BufferedReader stdin=new BufferedReader (

new InputStreamReader(System.in));



String s;

int x;

int i=2;

boolean isPrime=true;



System.out.print("Enter an integer >= 2: ");

System.out.flush();

s = stdin.readLine();

x = Integer.parseInt(s); //the line giving error



//Print the result

if (isPrime (x))

System.out.println(x + " is a prime number.");

else

System.out.println(x + " is not a prime number.");

}//end main method



static boolean isPrime (int n)

{

if (n==1) {

return false;

}

if (n==2)

{

return true;

}//End if loop



for (int i=2; i

{

if

(n%i==0)

return false ;



}// End for loop;



return true;

}//End of method isPrime



}// end of class DetectPrime

   <<Less

Re: Funny Compile Error

Posted By:   Dermot_Hennessy  
Posted On:   Monday, August 27, 2001 04:18 AM

Are all of the other machines which can compile this code running Windows ME? And the same JDK?

Dermot
About | Sitemap | Contact