Warrior Forum - The #1 Digital Marketing Forum & Marketplace

Warrior Forum - The #1 Digital Marketing Forum & Marketplace (https://www.warriorforum.com/)
-   Programming (https://www.warriorforum.com/programming/)
-   -   Java error cannot find symbol? (https://www.warriorforum.com/programming/447393-java-error-cannot-find-symbol.html)

jhonrtin 8th September 2011 01:09 AM

Java error cannot find symbol?
 
/**
* Print to the screen.
*
* @author Beginner.
*/
public class Mag {


public static void main(String[] args) {

double circumference = 2 * Math.PI * radius;

System.out.println ("slant height (s): " + circumference);


}
}


I get:
Beginner.java:13: error: cannot find symbol
double circumference = 2 * Math.PI * radius;
......................................… ^

symbol: variable radius
location: class Beginner


Please help!
Thanks

handyman 8th September 2011 02:34 AM

Re: Java error cannot find symbol?
 
The radius variable is not declared. Use this code,

Code:

/**
* Print to the screen.
*
* @author Beginner.
*/
public class Mag {

public static void main(String[] args) {

int radius = 10;

double circumference = 2 * Math.PI * radius;

System.out.println ("slant height (s): " + circumference);


}
}


windso0 8th September 2011 02:54 AM

Re: Java error cannot find symbol?
 
My guess is that you have a problem with your classpath or you path settings.

IBank 9th September 2011 05:50 AM

Re: Java error cannot find symbol?
 
Its not the classpath
Just as handyman suggested, the radius variable is not declared.

jhonrtin 15th September 2011 04:07 AM

Re: Java error cannot find symbol?
 
Thanks to all


All times are GMT -6. The time now is 04:54 AM.