0
What is the error showing? How to declare constant?
class areaofradius { public static void main (String args[]){ Double ra; Scanner ra=new Scanner (System.in); ra=nextdouble(); constant pi=3.14; Areaofradius=pi*ra*ra; } }
1 Answer
+ 2
Umm.... it seems that your whole program is wrong...
class areaofradius
{
public static void main (String args[]){
double ra; // lowercase 'd'
Scanner sc = new Scanner(System.in); // ra is already declared
ra = nextDouble(); //uppercase 'D'
static final double pi=3.14; // This is how you declare a constant
double Areaofradius=pi*(ra*ra);
}
}