Barron Snyder

Greenhorn
+ Follow
since Nov 01, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Barron Snyder

Thanks Anuradha and Jeroen.
I think I understand now. A constructor is being called for the array. That makes sense. And in this case, with Thread (or I suppose any class/object), I should look to see whether it is followed by brackets [ ] or parentheses ( ). With brackets, we are instantiating an array of those Thread objects (but not the Thread objects themselves) and with parentheses, we are instantiating the actual Thread objects.
Hi,
I just started reading Kathy and Bert's book and was stopped by the same *apparent* (in my mind) contradiction as the person who originally started this topic. I'm just not getting it.
Exerpted from Page 20:


Thread[] threads = new Thread[5];
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!
SNIP
....
SNIP
You can say with certainty, for example, that any code that uses the keyword new will (if it runs successfully) cause the class constructor and all superclass constructors to run.


So why are there no Thread objects created (no Thread constructor called) even though the new keyword was used?
Is it because in this example new is being called to create the array and not the threads in the array? If this is the case, then when/how does the Thread constructor run?
I'm confused. If anybody could restate what the book is saying in perhaps a slightly different way, maybe I'll get a clue.
Thanks,
Barron
[ May 09, 2004: Message edited by: Barron Snyder ]
As previously mentioned, take a look at hsqldb. There's even a compiled .ipk for easy installation on the Zaurus and a gui frontend for table creation!
From the website:
hsqldb is a relational database engine written in Java, with a JDBC driver, supporting a subset of ANSI-92 SQL (BNF tree format). It offers a small (about 100k), fast database engine which offers both in memory and disk based tables. Embedded and server modes are available. Additionally, it includes tools such as a minimal web server, in-memory query and management tools (can be run as applets or servlets, too) and a number of demonstration examples.
-Barron
21 years ago