this is my code it showing some exception error help to resolve and want to know what is the cause of this exception.
//using class to find the area of circle and cylinder //using inheritance also //using circle class to find the area of the cylinder
class circle{
public int radius;
public double area;
circle(int r)
{
this.radius = r;
}
public double areaCircle(){
area = Math.PI* radius * radius;
return area;
}
}
class cylinder1 extends circle{
public int height ;
public double SurfaceArea;
cylinder1(int r,int h) {
super(r);
this.height = h;
}
public double areaCylinder(){
SurfaceArea = 2 * Math.PI * radius * height+ 2 * areaCircle();
return SurfaceArea;
}
}
public class practice_inheritance {
public static void main(String[] args) {
//problem 1
cylinder1 sac = new cylinder1(2,3);
System.out.println(sac.areaCylinder());
}
}