Java error cannot find symbol?

4 replies
/**
* 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
#error #find #java #symbol
  • Profile picture of the author handyman
    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);
    
    
    }
    }
    {{ DiscussionBoard.errors[4634195].message }}
  • Profile picture of the author windso0
    My guess is that you have a problem with your classpath or you path settings.
    {{ DiscussionBoard.errors[4634290].message }}
  • Profile picture of the author IBank
    Its not the classpath
    Just as handyman suggested, the radius variable is not declared.
    {{ DiscussionBoard.errors[4642885].message }}
    • Profile picture of the author jhonrtin
      Thanks to all
      {{ DiscussionBoard.errors[4681979].message }}

Trending Topics