Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 8th Sep 2011, 01:09 AM   #1
Warrior Member
 
Join Date: 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default
Java error cannot find symbol?
Share on: 
fb share twitter share gplus share more share

/**
* 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
jhonrtin is offline  
Unread 8th Sep 2011, 02:34 AM   #2
WordPress Developer
War Room Member
 
handyman's Avatar
 
Join Date: 2009
Posts: 45
Thanks: 3
Thanked 0 Times in 0 Posts
Default
Re: Java error cannot find symbol?
Share on: 
fb share twitter share gplus share more share

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);


}
}
handyman is offline  
Unread 8th Sep 2011, 02:54 AM   #3
Active Warrior
 
Join Date: 2011
Posts: 68
Thanks: 0
Thanked 5 Times in 5 Posts
Default
Re: Java error cannot find symbol?
Share on: 
fb share twitter share gplus share more share

My guess is that you have a problem with your classpath or you path settings.

windso0 is offline  
Unread 9th Sep 2011, 05:50 AM   #4
Warrior Member
 
Join Date: 2011
Posts: 25
Thanks: 4
Thanked 0 Times in 0 Posts
Default
Re: Java error cannot find symbol?
Share on: 
fb share twitter share gplus share more share

Its not the classpath
Just as handyman suggested, the radius variable is not declared.
IBank is offline  
Unread 15th Sep 2011, 04:07 AM   #5
Warrior Member
 
Join Date: 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default
Re: Java error cannot find symbol?
Share on: 
fb share twitter share gplus share more share

Thanks to all
jhonrtin is offline  
Closed Thread


Bookmarks

Tags
error, find, java, symbol


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




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