You can also declare and construct an array in one statement as follows:
int testScores = new int;
This single statement produces the same result as the two previous statements.
Arrays of object types can be constructed in the same way:
Thread threads = new Thread;
The key point to remember here is that—despite how the code appears—the
Thread constructor is not being invoked. We’re not creating a Thread instance, but
rather a single Thread array object. After the preceding statements, there are still
no actual Thread objects!
Think carefully about how many objects are on the heap after a code statement
or block executes. The exam will expect you to know, for example, that the
preceding code produces just one object (the array assigned to the reference
variable named threads). The single object referenced by threads holds five
Thread reference variables, but no Thread objects have been created or assigned
to those references.
- Anonymous1 decade agoFavorite Answer
( 這裡是指Thread threads = new Thread )
不過他是一個擁有 5 個 Thread refrence 陣列的 object，
該 object 裡面的 5 個 Thread 並未被 new 出來。Source(s): myself