There seems to be some confusion over what exactly you're trying to do.
Do you already have an array created, and you just want to find out the length of that already-existing array? And then you want to pass that length to the constructor of another class?
If so, then Migeul's code is right on the money. He's creating an array (in this case, it has 17 elements), and he's asking that array how long it is, using the length() method. That method will return 17 of course, and that result of 17 is therefore what gets passed to the constructor. The constructor then simply stores that value in an instance variable in your new object.
Okay, so on to the second possiblity:
Do you not already have an array created? And do you want to pass an arbitrary number (could be 17, could be 5, could be anything) to the constructor of a class? And do you then want that construction to create a new array right there on the spot, using the number you gave it (17, or 5, or whatever) to determine the size of this newly-created array?
If so, then Stan's question is leading you in the right direction. He's set it up so that you can pass any number to a constructor. It could be anything--that all depends on how you call the constructor. It's intended to be used like this:
Demo myDemo1 = new Demo(17);
Demo myDemo2 = new Demo(5);
See, when we use "new" to create a new instance of Stan's Demo class, we pass a number to the constructor. The question he's asking is, how would you get your construction to create a brand-new array of the size we've asked for?
Remember, the constructor doesn't know how big it will be asked to make the array, so you can't just type in a number like this:
myArray = new int;
...because you don't know that 17 is the correct size. But you do know that, whatever the size should be, that size will be passed as an argument and stored in that integer variable called "size".
I was after a different problem description perhaps. I guessed the assignment is: "Create an object that contains an array. We'll tell the object how big the array should be through the constructor." So my missing line would be something that creates a new array of the specified size.
How do you make a new array? How do you tell it how big to be?
Your answer might be: That wasn't the assignment at all! Then I'll just crawl away.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Be careful: Programmers new to the Java programming language are tempted to follow length with an empty set of parenthesis. This doesn't work because length is not a method. length is a property provided by the Java platform for all arrays.