I'm starting a main class but when i refer the name back to my other java class, it cannot find the constructor when it is clearly there, in the right file directory.
I'll give you the code from my constructor and the code i'm using in the main class.

Constructor in Java class:

public Box(double height, double width, double depth, boolean full) {
        this.height = height;
        this.width = width;
        this.depth = depth;
        this.full = full;

Java main class:

public static void main(String[] args) {

         Box firstBox = new Box("This is the first box: ", 411);

Can anyone figure out what is wrong?

Your constructor needs 4 parameters (3 doubles, 1 boolean).
You are trying to call it with 2 parameters (1 String, 1 int).

Your constructor needs 4 parameters (3 doubles, 1 boolean).
You are trying to call it with 2 parameters (1 String, 1 int).

I've done this and still there's a problem. The program cannot instantiate Box( double, double, double, boolean)

Please post your actual current code and the exact error message.

Please post your actual current code and the exact error message.

Actual Main class

public static void main(String[] args) {

         Box firstBox = new Box(height, width, depth, full);

Error message: Internal Error, cannot instantiate Box(double, double, double, boolean) at programprojects4.Box to ()

You need to post all the code, not just 2 lines!

You need to post all the code, not just 2 lines!

That is all of the code, i won't go further into the program until i've solved this 'cannot find symbol' error for Box

If that's the whole thing:
You haven't defined your variables
you haven't initialised your variables
you don't have a closing }
etc

If that's the whole thing:
You haven't defined your variables
you haven't initialised your variables
you don't have a closing }
etc

package programprojects4;


public class BoxTest {
     public static void main(String[] args) {

         Box firstBox = new Box();
        

     }

}

Sigh. I don't think I can help you here. Maybe someone else? Good luck.

Sigh. I don't think I can help you here. Maybe someone else? Good luck.

Thanks for your time and effort.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.