0

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());
        }
    }
  • 1
    You should share the whole stacktrace or at least specify which class could not be found. Also check out the answers in https://stackoverflow.com/questions/17973970/how-can-i-solve-java-lang-noclassdeffounderror or https://stackoverflow.com/questions/6334148/exception-in-thread-main-java-lang-noclassdeffounderror – Sebastian Dec 27 '21 at 07:35

0 Answers0