Actual and formal argument lists differ in length Java

When you call this line in your main class:

largeCylinder = new Cylinder(label, height, radius);

you get an error bcz there is no constructor in your Cynlinder class that does this. In fact, you have NO constructors at all in your cynlinder class.

Put this into your Cylinder class and try again:

public Cylinder(String constructLabel, double constructHeight, double constructRadius) {
    // required constructor class
    label = constructLabel;
    height = constructHeight;
    radius = constructRadius;

Now create the object and do this to calculate the cylinder:


You other option is to just say:

largeCylinder = new Cylinder();

Leave a Comment